Databases: Why NULL Is Not Equal to NULL
How databases store, find and protect data: the relational model, SQL's surprises, normalization, indexes, query plans, transactions and NoSQL trade-offs.
Databases · 50 questions
Try 3 questions
1. In the relational model, what does the word 'relation' actually mean?
- A table of rows and columns
- A link joining two tables
- A rule pairing two values
Show the answer
Answer: A table of rows and columns
Codd borrowed the mathematical term: a relation is a set of tuples, which we draw as a table. Links between tables are separate.
2. Since a relation is a mathematical set, what does relational theory say about the order of its rows?
- Rows keep their insertion order
- Rows have no inherent order
- Rows are sorted by primary key
Show the answer
Answer: Rows have no inherent order
That's why SQL only guarantees order when you write ORDER BY; otherwise the database may return rows in any order.
3. What must always be true of a table's primary key?
- Always the first column of the table
- Unique and never null for every row
- Always a number that counts upward
Show the answer
Answer: Unique and never null for every row
A primary key identifies each row; it may be text or several columns, but it can't repeat or be missing.
The whole quiz comes before your apps
BrainTok asks a few questions like these before the apps you choose open, so your screen time turns into learning. For iPhone.
Join the beta