next
Round
Technologies
Experiences
Contribute
Login
next
Round
Technologies
Experiences
Contribute
Login
Question Loading...
Keys
1. What is a key in MySQL and why is it used?
Level: Expert | Frequency: High
2. What is the difference between a key and an index?
Level: Expert | Frequency: High
3. What is a primary key? Can a table have more than one primary key?
Level: Expert | Frequency: High
4. What is a foreign key and why is it important in relational databases?
Level: Expert | Frequency: High
5. How do you define a primary key when creating a table?
Level: Expert | Frequency: High
6. Can a primary key column contain NULL values? Why or why not?
Level: Expert | Frequency: High
7. What is the difference between a UNIQUE key and a PRIMARY key?
Level: Expert | Frequency: High
8. What is an AUTO_INCREMENT key, and how does it work with the primary key?
Level: Expert | Frequency: High
9. Can two tables have the same primary key name? Explain.
Level: Expert | Frequency: High
10. What is the purpose of the FOREIGN KEY constraint in maintaining referential integrity?
Level: Expert | Frequency: High
11. What is a composite key? How do you define one in MySQL?
Level: Expert | Frequency: High
12. What are candidate keys, and how do they differ from alternate keys?
Level: Expert | Frequency: High
13. What happens if you try to insert a duplicate value into a UNIQUE key column?
Level: Expert | Frequency: High
14. How do foreign key constraints behave on DELETE and UPDATE operations (CASCADE, SET NULL, etc.)?
Level: Expert | Frequency: High
15. What are the differences between ON DELETE CASCADE and ON DELETE SET NULL? What is a super key, and how does it relate to candidate keys? Can a foreign key reference a non-primary key column in another table?
Level: Expert | Frequency: High
16. How do you disable and re-enable foreign key checks in MySQL? Why would you do that?
Level: Expert | Frequency: High
17. How do you drop a primary key or foreign key from an existing table?
Level: Expert | Frequency: High
18. How can you find all foreign key relationships in a MySQL database?
Level: Expert | Frequency: High
19. How does InnoDB enforce foreign key constraints internally?
Level: Expert | Frequency: High
20. What is the impact of defining multiple UNIQUE keys on the same table?
Level: Expert | Frequency: High
21. Can you define a foreign key constraint referencing a table in a different database schema?
Level: Expert | Frequency: High
22. Explain how key definitions affect indexing and query optimization.
Level: Expert | Frequency: High
23. What are the differences between logical keys (like candidate or composite keys) and physical indexes?
Level: Expert | Frequency: High
24. Can a composite key contain a foreign key as one of its columns? Provide an example.
Level: Expert | Frequency: High
25. How does MySQL handle updates to parent keys that are referenced by foreign keys?
Level: Expert | Frequency: High
26. What are deferred constraint checks, and does MySQL support them? How do you design keys in a many-to-many relationship using a junction (bridge) table? What are the potential performance implications of using multiple foreign keys and composite keys in large-scale systems?
Level: Expert | Frequency: High
All Topics
Basics
Databases
Tables
Data Types
Queries
Views
Indexes
Clauses
Regex
Functions and Operators
Keys
Joins
Joins
Triggers