Tables and Select
Create and Insert
Building a Table
A SQL table starts with named columns. INSERT adds rows, and SELECT reads the table back.
Program
Play the script to watch an empty table become two rows.
create_insert.sql
CREATE TABLE users (id INTEGER, name TEXT);
INSERT INTO users VALUES (1, 'Ada');
INSERT INTO users VALUES (2, 'Lin');
SELECT * FROM users ORDER BY id;
CREATE TABLE
`CREATE TABLE` defines the columns a table can store.
INSERT
`INSERT INTO ... VALUES` appends a row.
SELECT
`SELECT *` returns every column from the table.