0
0
DBMS Theoryknowledge~20 mins

Keys (primary, candidate, foreign, super) in DBMS Theory - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Key Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Primary Keys

Which of the following best describes the role of a primary key in a database table?

AIt uniquely identifies each record and cannot contain NULL values.
BIt is a key that can have duplicate values and may contain NULLs.
CIt is used to link two tables but does not uniquely identify records.
DIt is any attribute that can be used to identify records but is not necessarily unique.
Attempts:
2 left
💡 Hint

Think about what makes each row in a table unique and mandatory.

📋 Factual
intermediate
2:00remaining
Candidate Keys Characteristics

Which statement correctly defines a candidate key?

AA candidate key is a key that is chosen as the primary key.
BA candidate key is a key that can contain duplicate values.
CA candidate key is a key that references another table's primary key.
DA candidate key is any attribute or set of attributes that can uniquely identify a record.
Attempts:
2 left
💡 Hint

Think about keys that could potentially be primary keys.

🔍 Analysis
advanced
2:00remaining
Foreign Key Purpose

What is the main purpose of a foreign key in a relational database?

ATo serve as an alternate unique identifier within the same table.
BTo enforce referential integrity by linking to a primary key in another table.
CTo uniquely identify each record within its own table.
DTo allow duplicate values within a table for faster searches.
Attempts:
2 left
💡 Hint

Consider how tables relate to each other in a database.

Comparison
advanced
2:00remaining
Super Key vs Candidate Key

Which of the following statements correctly distinguishes a super key from a candidate key?

AA super key is any key that uniquely identifies records; a candidate key is a minimal super key with no extra attributes.
BA super key must be chosen as the primary key; a candidate key cannot be primary.
CA candidate key can contain duplicate values; a super key cannot.
DA super key is always a foreign key; a candidate key is always a primary key.
Attempts:
2 left
💡 Hint

Think about minimality and uniqueness in keys.

Reasoning
expert
2:00remaining
Identifying Keys in a Table

Consider a table Employees with columns: EmployeeID, Email, PhoneNumber, and DepartmentID. Which of the following is not a valid candidate key?

A<code>EmployeeID</code> because it uniquely identifies each employee.
B<code>Email</code> assuming each employee has a unique email address.
C<code>PhoneNumber</code> assuming some employees share the same phone number.
D<code>EmployeeID</code> and <code>Email</code> combined as a composite key.
Attempts:
2 left
💡 Hint

Candidate keys must uniquely identify records without duplicates.