FC0-U71 ยท Data and databases
Relational databases: tables, keys and relationships
Tables, rows, fields, primary and foreign keys, and relationships between tables.
Key points
- A relational database stores data in tables.
- A row (record) is one item, a field (column) is one attribute.
- A primary key uniquely identifies each row.
- A foreign key is a field that holds the primary key of a row in another table, which creates the relationship and keeps the data consistent.
Source: https://www.postgresql.org/docs/current/tutorial-fk.html
Practice questions
What uniquely identifies each row in a relational table?
- The primary key
- The report
- The query
- The backup
Show answer
Answer: A. The primary key
The primary key has a unique value in every row. Reports, queries and backups work with rows but do not identify them.
Which statements about relational tables are correct?
- A row holds the data for one record
- A field (column) holds one attribute of every record
- Two rows in a table may share the same primary key value
- Every table must contain exactly one row
- A foreign key must always point to a column in the same table
Show answer
Answer: A. A row holds the data for one record, B. A field (column) holds one attribute of every record
Rows are records and columns are attributes. Primary key values must be unique, tables hold many rows, and a foreign key normally points to another table.
Two rows in the same table can have the same primary key value as long as other fields differ.
Show answer
Answer: False
A primary key must be unique across the whole table, whatever the other fields contain. Otherwise it could not identify a single row.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
