In a relational database, two tables, 'Orders' and 'Customers', are related to each other. The 'Customers' table has a 'CustomerID' which uniquely identifies each customer. When this 'CustomerID' is used in the 'Orders' table to link each order to the specific customer that placed it, which kind of key does the 'CustomerID' represent in the 'Orders' table?
In the 'Orders' table, 'CustomerID' acts as a foreign key because it is a field that references the primary key of another table, 'Customers', to establish a link between records in both tables. A primary key is unique within its own table only and cannot directly act as a key for another table. An index aids in quickly accessing data but does not inherently create a relationship between tables. While 'CustomerID' does uniquely identify each customer, within the context of the 'Orders' table, it serves the specific role of a foreign key.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a foreign key in a relational database?
Open an interactive chat with Bash
What is a primary key and how is it different from a foreign key?
Open an interactive chat with Bash
Can a field serve as both a primary key and a foreign key?