CREATE TABLE
CREATE TABLE defines a new table. Each column has a name and a type: INTEGER, REAL (decimals), TEXT. A PRIMARY KEY uniquely identifies each row.
Examplesql
NOT NULL makes a column required. With an INTEGER PRIMARY KEY, the database numbers new rows for you. DROP TABLE pets; deletes the whole table.
Quick check
What does PRIMARY KEY do?
Your turn: write the code
Create a table pets with columns id INTEGER PRIMARY KEY and name TEXT, insert one pet called 'Rex', then select the number of rows in pets.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.