Stage 2 · Lesson 6 of 6
Hands-on: a small relational schema with a JSON column
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
- CoursePaidGrokking 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
- GuideFreePostgreSQL Tutorial
PostgreSQL Global Development Group · Beginner
The short official tutorial: create a database, tables and your first queries in an evening
Practise
Keep handy
Also worth your time
json versus jsonb, the operators and how to index JSON for fast lookups
- Sefism SQL and Databases RoadmapGo deeper
The full Sefism roadmap for SQL: queries, schema design, transactions, indexes and SQL from code