The branch of mathematics that deals
with the formal properties of sets as
units (without regard to the nature of
their individual constituents) and the
expression of other branches of
mathematics in terms of sets
Why This Is Important
A whole branch of mathematics that deals
with collections of items and operations.
SQL is just one of many ways to describe
collections of items and operations.
Learning to think about data as discrete sets
of items opens new possibilities, because you
are given new operations to manipulate sets.
Structured Query Language
SQL is a language standard
Different databases products have extra
features tacked on to the language
Understand the structure of the language
Everything else is just syntax
Free and Open Source relational database LIBRARY
Most SQL products are considered a “RDBMS”
Relational Database Management System
Which means they contain extra functionality
Most data has a unique identiﬁer, somewhere
People: Social Security Numbers
SQL has a data type to give hints to the
database engine about these unique identiﬁers
Typically a table will have a PRIMARY KEY
Often, it is a automatically incremented
Blog post #1
Blog post #2
Two tables can be related through the use of
Customer table has a primary key (customer_id)
Order table has a primary key (order_id) and a
column (customer) that references the customer
The SQL database now knows about this relation.
Foreign Keys &
Foreign keys are used to enforce
You cannot have an order for a customer
that doesn’t exist.
You cannot delete a customer unless you also
delete their orders.
We will now go through a hands-on exercise
with SQLite and the sample database from
A more complete example database can be
found on the Chinook Project:
This is listed in Lesson_04.md of the GitHub