Choosing the right database

Stage 2 · Lesson 6 of 6

Hands-on: a small relational schema with a JSON column

Relational databases: the sensible default

Make it real. Install locally or create a free managed project, then build three for a small shop: customers, products and orders, with primary keys, and a NOT NULL or two. Give products a jsonb column called attributes for things like size or screen type.

Insert a dozen rows, then write three queries: orders with customer names (a ), products where an attribute equals a value (a JSON query) and daily order totals (GROUP BY). Finally, try to insert an order for a customer who does not exist and read the error. This takes an evening and touches every idea in the stage.

Common trapcopying a finished from a tutorial; type it yourself so the constraints make sense.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking Relational Database Design and Modeling

    Design Gurus · Intermediate · $98 one-time

    Data modelling, ER diagrams, keys and normalisation for the relational default, with worked designs

  • GuideFree
    PostgreSQL Tutorial

    PostgreSQL Global Development Group · Beginner

    The short official tutorial: create a database, tables and your first queries in an evening

Practise

  • Run SQL on PostgreSQL, MySQL or SQLite in the browser and compare how each handles JSON

  • Free interactive lessons if your SQL needs warming up before the hands-on task

Keep handy

Also worth your time

Mark this stage as not done?