To create a new table in a database, use the CREATE TABLE statement followed by the name of the table and the fields you want in the table.
CREATE TABLE employees (id INTEGER, name TEXT, age INTEGER, is_manager BOOLEAN, salary INTEGER);
Each field name is followed by its datatype. We'll get to data types in a minute.
It's also acceptable and common to break up the CREATE TABLE statement with some whitespace like this:
CREATE TABLE employees(
id INTEGER,
name TEXT,
age INTEGER,
is_manager BOOLEAN,
salary INTEGER
);
Let's begin building a table for CashPal database! Create the people table with the following fields:
IntegerTextTextIntegerIntegerbooleanUse INTEGER instead of INT before submitting your code.
While both types are functionally identical, INTEGER is the full standard-compliant keyword.
We prefer INTEGER in this course for clarity, consistency, and better portability across SQL dialects.
PRAGMA TABLE_INFO(TABLENAME); command in the test file returns information about a table and its fields.