Font size
WorksheetsDatabase Relationships Quiz
Total questions: 20
Worksheet time: 13mins
What is the primary role of a primary key in a table?
To store the most frequently accessed data
To uniquely identify each record in the table
To maintain referential integrity
To create relationships between tables
Which of the following is an example of a one-to-many relationship?
A student enrolled in multiple courses
An employee working in a single department
A product supplied by multiple suppliers
A customer placing multiple orders
What is a foreign key?
A key that provides a unique identifier for a table
A key that links two tables together
A key that allows many-to-many relationships
A key that can only be used in one table
In a many-to-many relationship, what is typically used to link two tables?
Foreign key
Junction table
Composite key
Primary key
Which of the following is a requirement for referential integrity?
Foreign key values must match the primary key in the related table
Foreign key values must match the primary key in the related table
Foreign key values must be null
Primary key values can be duplicated
Foreign key values must always be unique
What is the main function of a junction table?
To store additional information about a foreign key
To establish a one-to-one relationship between tables
To resolve many-to-many relationships between tables
To provide alternative foreign keys for a table
If a foreign key in a child table does not have a matching primary key in the parent table, what database issue arises?
Data inconsistency
Referential integrity violation
Data redundancy
Data normalization
What is a composite key?
A key composed of multiple foreign keys
A key made up of two or more columns to uniquely identify records
A key that enforces referential integrity
A key used only in junction tables
Which of the following best describes a one-to-one relationship?
One record in a table is related to many records in another table
Many records in one table are related to many records in another table
One record in a table is related to one record in another table
A single record in a table can have multiple foreign keys
In a many-to-many relationship, how many foreign keys does a junction table typically have?
One
Two
Three
None
Why is it important that foreign keys are non-null in certain cases?
It ensures every record has a matching value in the related table
It ensures referential integrity is violated
It prevents data duplication across tables
It makes foreign keys unique
Which of the following statements about primary keys is true?
Primary keys can contain null values
A table can have multiple primary keys
Primary keys must be unique for each record in the table
A primary key can be duplicated in another table
What is the main purpose of enforcing referential integrity?
To prevent data duplication within a table
To ensure related data is kept consistent between tables
To speed up query performance
To simplify database design
If a table contains two foreign keys, it is most likely to be:
A parent table in a one-to-one relationship
A junction table in a many-to-many relationship
Which of the following is NOT a valid reason for using a junction table?
A) To resolve a many-to-many relationship
B) To store metadata about the relationship between two tables
C) To provide additional data integrity checks
D) To enforce a one-to-one relationship
A primary key that consists of more than one column is called:
A) A composite key
B) A duplicate key
C) A concatenated key
D) A unique key
Which of the following describes a duplicate foreign key?
A) A foreign key that appears more than once in the same table
B) A foreign key that links the same two tables twice
C) A foreign key that exists in two tables with different values
D) A foreign key that exists in two different tables and points to the same primary key
Which of the following fields would most likely be a primary key?
A) CustomerName
B) ProductID
C) OrderDate
D) Price
Why are foreign keys important in relational databases?
A) They allow one-to-one relationships
B) They enforce referential integrity between related tables
C) They help in creating indexes
