In a relational database, what is a foreign key?

Practice Questions

Q1
In a relational database, what is a foreign key?
  1. A unique identifier for a record
  2. A key that links two tables together
  3. A key that is not indexed
  4. A key used for data encryption

Questions & Step-by-Step Solutions

In a relational database, what is a foreign key?
Correct Answer: A foreign key is a field in one table that links to a primary key in another table.
  • Step 1: Understand that a database is like a collection of tables, similar to a spreadsheet with rows and columns.
  • Step 2: Each table can have its own unique identifier for each row, called a primary key.
  • Step 3: A foreign key is a special field in one table that refers to the primary key in another table.
  • Step 4: This creates a connection or link between the two tables, allowing you to relate data from one table to another.
  • Step 5: For example, if you have a 'Customers' table and an 'Orders' table, the 'Orders' table can have a foreign key that links to the 'Customers' table to show which customer made each order.
No concepts available.
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely