Create and seed a small SQLite database in TablePlus
DatabasesmacOS4m393 stepsTablePlus
Built and seeded a SQLite database entirely through the TablePlus GUI — created a new connection, defined two related tables in the visual table editor with primary keys and column constraints, then entered and committed rows by hand in the data grid.
Current operation
Task
Create and seed a small SQLite database in TablePlus
Do everything through the TablePlus GUI — no SQL editor, just the connection creator,
table editor, and data grid.
Create a new SQLite connection: File ▸ New ▸ SQLite (or the "Create a new database" option on the connection screen). Save the file as shop.db at ~/Desktop/tableplus/shop.db, then connect to it.
Create a table named products using the table editor (the + button in the Structure/Tables view, not a typed CREATE TABLE), with these columns:
id — INTEGER, Primary Key, Auto Increment
sku — TEXT, Unique, Not Null
name — TEXT, Not Null
price_cents — INTEGER, Not Null
in_stock — INTEGER, default 1
Commit the table (⌘↩, or the Commit button, if TablePlus is showing pending changes).
Add these 4 rows directly in the data grid:
SKU-001, Ceramic Mug, 1299, 1
SKU-002, Steel Water Bottle, 1899, 1
SKU-003, Canvas Tote Bag, 2499, 0
SKU-004, Wool Beanie, 1599, 1
Create a second table named orders, referencing products by id (no foreign key constraint needed — SQLite can't add one to an existing table anyway; just use a plain integer column):
id — INTEGER, Primary Key, Auto Increment
product_id — INTEGER, Not Null (the id of the product this order is for)
quantity — INTEGER, Not Null
Add 2 rows to orders: (product_id=1, quantity=3) and (product_id=3, quantity=1).
Commit all remaining changes.
How it's graded
These criteria define the outcome each recording is checked against.
✓shop.db exists and is a valid SQLite database
✓products table has columns id (INTEGER PK autoincrement), sku (TEXT UNIQUE NOT NULL), name (TEXT NOT NULL), price_cents (INTEGER NOT NULL), in_stock (INTEGER default 1)
✓products has exactly 4 rows: SKU-001/Ceramic Mug/1299/1, SKU-002/Steel Water Bottle/1899/1, SKU-003/Canvas Tote Bag/2499/0, SKU-004/Wool Beanie/1599/1
✓orders table has columns id (INTEGER PK autoincrement), product_id (INTEGER NOT NULL, values match a real products.id), quantity (INTEGER NOT NULL)
✓orders has exactly 2 rows: (product_id=1, quantity=3), (product_id=3, quantity=1)