Multi-Table Relational SQL :Using Databases with Python (Python for Everybody Specialization) Answers 2025
Question 1
What is the primary added value of relational databases over flat files?
✅ Ability to scan large amounts of data quickly
❌ Ability to convert to HTML
❌ Execute JavaScript
❌ Send across network
❌ Execute Python code
Explanation:
Relational databases allow fast searching, indexing, and joining of large datasets — which flat files cannot do efficiently.
Question 2
What is the purpose of a primary key?
✅ To look up a particular row in a table very quickly
❌ To track duplicates
❌ To point to another table
❌ To look up based on a string
Explanation:
A primary key uniquely identifies a row and allows quick access within a table.
Question 3
Which of the following is NOT a good rule to follow when developing a database model?
✅ Use a person’s email address as their primary key
❌ Model each “object” as one or more tables
❌ Never repeat string data
❌ Use integers as primary keys
Explanation:
Emails can change — they are not reliable identifiers. Always use integer-based primary keys for consistency.
Question 4
If a user interface has repeated strings on one column, how should we model it in a database?
✅ Make a table that maps the strings in the column to numbers and then use those numbers in the column
❌ Put NULLs
❌ Use row numbers
❌ Encode as JSON
Explanation:
This is normalization — repeated data should be moved into a separate lookup table and linked using foreign keys.
Question 5
Which column label is used by the “outside world” to look up a particular row?
✅ Logical key
❌ Local key
❌ Remote key
❌ Foreign key
❌ Primary key
Explanation:
A logical key is meaningful outside the database (like email or username).
A primary key is internal and system-generated.
Question 6
What is the label for a column used to point to a row in another table?
✅ Foreign key
❌ Logical key
❌ Local key
❌ Remote key
❌ Primary key
Explanation:
A foreign key links rows in one table to primary keys in another table.
Question 7
What SQLite keyword is added to primary keys to have the database auto-generate values?
✅ AUTOINCREMENT
❌ INSERT_AUTO_PROVIDE
❌ AUTO_INCREMENT
❌ ASSERT_UNIQUE
Explanation:
In SQLite, AUTOINCREMENT tells the database to automatically generate an integer ID for each new row.
Question 8
What SQL keyword reconnects rows with foreign keys to the referenced data?
✅ JOIN
❌ APPEND
❌ COUNT
❌ CONNECT
❌ CONSTRAINT
Explanation:JOIN merges data from multiple tables based on related columns (usually foreign key relationships).
Question 9
What happens when you JOIN two tables without an ON clause?
✅ The number of rows = rows in table 1 × rows in table 2
❌ You get NULLs
❌ You get no rows
❌ Syntax error
❌ Only matching rows
Explanation:
Without an ON clause, SQL performs a Cartesian product — every row in table A is paired with every row in table B.
Question 10
How do you distinguish identical column names when joining multiple tables?
✅ tablename.columnname
❌ tablename->columnname
❌ tablename[‘columnname’]
❌ tablename/columnname
Explanation:
Use dot notation (table.column) to specify which table a column belongs to in a multi-table query.
🧾 Summary Table
| # | ✅ Correct Answer | Key Concept |
|---|---|---|
| 1 | Ability to scan large amounts quickly | Relational DB advantage |
| 2 | To look up a particular row | Purpose of primary key |
| 3 | Use email as PK (bad) | Database design rule |
| 4 | Mapping table for strings | Normalization |
| 5 | Logical key | External identifier |
| 6 | Foreign key | Relationship between tables |
| 7 | AUTOINCREMENT | Auto ID generation |
| 8 | JOIN | Combine data across tables |
| 9 | Cartesian product | Join without ON |
| 10 | tablename.columnname | Column disambiguation |