Question 31
MediumWhat does ON DELETE CASCADE on a foreign key do?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
What does ON DELETE CASCADE on a foreign key do?
Deleting a parent row automatically deletes the child rows that refer to it
Prevents deleting any parent row
Deletes the whole table
Sets the child foreign keys to NULL
Sign up free to see the answer and a step-by-step explanation.
What is a composite key?
A key with a single column
An encrypted key
A key that is also a foreign key
A key made of two or more columns
Sign up free to see the answer and a step-by-step explanation.
Which relational algebra operation selects rows that satisfy a condition?
Cartesian product (×)
Projection (π)
Union (∪)
Selection (σ)
Sign up free to see the answer and a step-by-step explanation.
Which relational algebra operation picks certain columns and removes duplicate rows?
Projection (π)
Join (⋈)
Difference (−)
Selection (σ)
Sign up free to see the answer and a step-by-step explanation.
Relation R(A, B, C, D) has FDs A → B and B → A, and no others. Which sets are candidate keys?
ABCD only
ACD and BCD
AB only
A only
Sign up free to see the answer and a step-by-step explanation.
Which statement about candidate keys and super keys is true?
Candidate keys may contain redundant attributes
A table has exactly one super key
Every super key is a candidate key
Every candidate key is a super key, but not every super key is a candidate key
Sign up free to see the answer and a step-by-step explanation.
Student(roll, email, name) has roll and email both unique and NOT NULL. roll is chosen as the primary key. What is email?
A foreign key
A composite key
An alternate key
A super key only, not a candidate key
Sign up free to see the answer and a step-by-step explanation.
Order(order_id, cust_id) has cust_id as a foreign key to Customer. What happens on inserting an order with a cust_id that is not in Customer?
The order is saved with NULL
A new customer is created automatically
The customer table is dropped
The insert is rejected
Sign up free to see the answer and a step-by-step explanation.
A foreign key is declared ON DELETE SET NULL. A parent row is deleted. What happens to the child rows that referred to it?
Their foreign key becomes NULL
Nothing changes
The delete is refused
They are deleted
Sign up free to see the answer and a step-by-step explanation.
Which constraint does a primary key enforce that a UNIQUE constraint alone does not?
Referential integrity
NOT NULL
CHECK
Uniqueness
Sign up free to see the answer and a step-by-step explanation.