๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Data Analytics with SQL & Excel Module 5 ยท Lesson 13 of 15

0% Exit to course

Module 5 ยท From query to a defensible answer Lesson 13 of 15

Reading a schema before you write a query

Learning objective

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.

Create free account or sign in

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.

Next recommended course Interview DSA Crash Course