CREATE TABLE
CREATE TABLE names the table and lists each column with its data type and optional rules. Choose the type that fits the data: INTEGER for whole numbers, TEXT or VARCHAR for text, REAL or DECIMAL for decimals and DATE for dates.
Example
CREATE TABLE teachers (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
subject TEXT,
hired_on DATE
);
INSERT INTO teachers (id, name, subject) VALUES (1, 'Mr. Bello', 'Python');
SELECT * FROM teachers;Result
id | name | subject | hired_on 1 | Mr. Bello | Python | NULL
Exercise
Define a new table.
TABLE teachers (id INTEGER);Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.