CompTIA Tech+ (FC0-U71)Data and Database FundamentalsMedium
A school database has a Teachers table and a Classes table, where a single teacher can be assigned to teach many different classes, but each class has only one teacher. Which type of relationship does this describe?
- ASelf-referencing
- BOne-to-one
- COne-to-many
- DMany-to-many
Show answer & explanationAnswer & explanation
Correct answer: C. One-to-many
A one-to-many relationship exists when a single record in one table (a teacher) can be associated with multiple records in another table (classes), but each class links back to only one teacher. One-to-one links single records exclusively, many-to-many requires a junction table, and self-referencing links a table to itself.
Why the other options are wrong
- A. Self-referencing relates a table to itself, not two separate tables.
- B. One-to-one would mean each teacher has only one class and vice versa.
- D. Many-to-many would require classes to have multiple teachers, which is not the case.
One-to-Many Relationship
A relationship type where one record in a table can relate to multiple records in another table, but each of those records relates back to only one record in the first table.
- Most common relationship type in relational databases
- Implemented by placing a foreign key in the 'many' side table
- Example: one customer can place many orders
Memory trick: One teacher, many classes — the foreign key lives on the many side.