Bird
0
0

What is the main purpose of a FOREIGN KEY constraint in a database?

easy📝 Conceptual Q11 of 15
SQL - Table Constraints
What is the main purpose of a FOREIGN KEY constraint in a database?
ATo store large amounts of text data efficiently
BTo speed up database queries by creating indexes
CTo link two tables by ensuring values in one table match values in another
DTo automatically backup the database
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of FOREIGN KEY

    A FOREIGN KEY connects columns in two tables to keep data related and consistent.
  2. Step 2: Compare options with this role

    Only To link two tables by ensuring values in one table match values in another describes linking tables by matching values, which is the purpose of FOREIGN KEY.
  3. Final Answer:

    To link two tables by ensuring values in one table match values in another -> Option C
  4. Quick Check:

    FOREIGN KEY links tables = A [OK]
Quick Trick: FOREIGN KEY links tables by matching columns [OK]
Common Mistakes:
MISTAKES
  • Confusing FOREIGN KEY with indexing
  • Thinking FOREIGN KEY stores data
  • Assuming FOREIGN KEY backs up data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes