A foreign key links two tables together by referencing the primary key of another table.
Questions & Step-by-step Solutions
1 item
Q
Q: In a database, what does a 'foreign key' do?
Solution: A foreign key links two tables together by referencing the primary key of another table.
Steps: 5
Step 1: Understand that a database is like a collection of tables that store information.
Step 2: Know that each table can have a 'primary key', which is a unique identifier for each record in that table.
Step 3: A 'foreign key' is a special column in one table that refers to the primary key of another table.
Step 4: This connection allows you to link related data from different tables together.
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.