×

sql · level 1 · unit 7 · lesson 1

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

builds a new, empty table.

Until now, every table was ready and waiting. CREATE TABLE builds your own. Give it a name, then list its columns in brackets, with commas between.

Each column gets a name and a : the kind of value it holds. TEXT is for words. INTEGER is for whole numbers, like ages and scores.

A new table starts empty, so INSERT some rows before you SELECT. Make a table with a name that is already taken and you get table already exists.

CREATE TABLE plants (name TEXT, height INTEGER);
INSERT INTO plants VALUES ('Fern', 40), ('Cactus', 12);
SELECT * FROM plants;

Table and column names follow the alias rules: one word, or words joined with underscores.