Objective 105.3: SQL Data Management

  • Common MySQL datatypes are integer, float, boolean, date, timestamp, datetime, char, varchar, blob, and text.

  • The SQL syntax for creating a table with one varchar column and one auto-increment integer column (which is also the primary key) is:

    CREATE TABLE test (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, \
    column1 varchar(255), PRIMARY KEY (id));
  • INSERT is used to insert data into a table, UPDATE is used to modify a data value in an existing table row, and SELECT is used to display values from a table.

  • ALTER TABLE is used to add/remove columns to a table, or modify a datatype.

  • A LEFT JOIN is used when we want to display items from two or more tables connected by a relationship, where each item present in the left table will display in the results, even if there is not a match with the other table being joined.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.