Module 5 ยท From query to a defensible answer Lesson 13 of 15
Reading a schema before you write a query
Two minutes looking at the tables saves an hour of wrong results. Find the primary keys, the foreign keys that link the tables, and which columns can be NULL, before a single SELECT.
Worked example
SHOW CREATE TABLE jobs reveals the foreign keys, so you know jobs.company_id points at companies.id and not the other way round.
Your practice task
Describe three tables in a paragraph each: their keys, the columns that can be NULL, and which other tables they join to.
Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.
Key takeaway
Two minutes looking at the tables saves an hour of wrong results. Find the primary keys, the foreign keys that link the tables, and which columns can be NULL, before a single SELECT.
Keep your place in this course
A free account saves which lessons you have finished and unlocks the certificate. The lesson itself stays free to read.
Create free account or sign inCourse complete
You finished every lesson.
Your certificate is ready, and the projects you built are the proof to attach to an application.
Almost there
15 lessons left of 15
Finish every lesson to unlock the certificate. Each one ends in a practice task โ do them and the final project brief writes itself.