Which term defines a column, or group of columns, that refers to a primary key in a different table?
A foreign key is a column (or a set of columns) that establishes a relationship between two tables by referencing the primary key of another table.
Example Usage:
sql
CREATE TABLE Departments (
DeptID INT PRIMARY KEY,
DeptName VARCHAR(50)
);
CREATE TABLE Employees (
EmpID INT PRIMARY KEY,
Name VARCHAR(50),
DeptID INT,
FOREIGN KEY (DeptID) REFERENCES Departments(DeptID)
);
DeptID in Employees is a foreign key, referencing DeptID in Departments.
Ensures referential integrity DeptID in Employees must exist in Departments.
Why Other Options Are Incorrect:
Option A (Super key) (Incorrect): A super key is any set of columns that uniquely identifies a row, but it does not reference another table.
Option B (Simple key) (Incorrect): A simple key is a single-column primary key, not a reference to another table.
Option C (Composite key) (Incorrect): A composite key consists of multiple columns but does not necessarily reference another table.
Thus, the correct answer is Foreign key, as it establishes a connection between two tables.
Val
7 hours agoVernice
5 days agoVon
11 days agoRodrigo
16 days agoNobuko
2 months agoStephanie
2 months agoGerman
3 months agoDella
3 months agoJacquline
3 months agoDaron
4 months ago