Grader Labs
← All samples

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 trajectory frame

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.

  1. 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.
  2. 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
  3. Commit the table (⌘↩, or the Commit button, if TablePlus is showing pending changes).
  4. 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
  5. 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
  6. Add 2 rows to orders: (product_id=1, quantity=3) and (product_id=3, quantity=1).
  7. Commit all remaining changes.

How it's graded

These criteria define the outcome each recording is checked against.