Unit 0: Start here: databases, tables and SQL
Know what a database is, what a table, a row and a key are, and the six practice tables you will use in every lesson.
The big picture
Almost every app keeps its data in a relational database, and SQL is how you ask it questions. Learn the shape of the data first — tables, rows, keys — and every later topic is just a new way of asking.
Lessons in this unit
- What a database, a table and SQL are: A relational database stores data in tables of rows and columns, and SQL (Structured Query Language) is the language you use to ask it questions and to change what it holds.
- Meet the practice database: Six small tables — departments, employees, customers, orders, products and order_items — that every example and exercise in this course uses.
- Keys and relationships: primary keys, foreign keys, one-to-many, many-to-many: A primary key is a column whose value identifies exactly one row. A foreign key is a column that holds another table's primary key, and these links are how tables relate: one-to-many, many-to-many or one-to-one.
- Data types: numbers, text, dates and true/false: Every column has a data type, such as INTEGER, a decimal number, TEXT, a date or a boolean. The type decides what values the column can hold, and how they compare, sort and calculate.