answersLogoWhite

0


Best Answer

In the context of relational databases, a foreign key is a referential constraint between two tables.[1] The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This way references can be made to link information together and it is an essential part of database normalization. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table, or referenced table) to many (child table, or referencing table) relationship. The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a foreign key is known in SQL:2003 as self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a foreign key?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

The key foreign policymakers are?

The key foreign policy makers are?


Can a foreign key be null?

yes .a foreign key can have null values


The foreign key uniquely identifies a record in a table T or F?

False. A foreign key is a primary of one table that is in another table. A foreign key can be repeated, so it does not uniquely identify records in the table where it is a foreign key.


How do you use foreign key in to oracle?

the foreign key referential between two tables.


Can a foreign-key column can contain duplicate values?

yep foreign key can have duplicate values


How do you apply a foreign key in a database?

The foreign key is a reference to a key (identifier) of a row in another or even the same table. When the foreign key is not null, it implies that there's an entry in the referenced table with that identifier. The syntax depends on wich database are you using, check the page in the related links below.


Explain the concept of foreign key How a foreign key differs from a primary key?

Foreign keys are used to link one database with another. A primary key is an attribute of a record that allows users to identify information.


Types of keys in database management system?

super key foreign key candidate key surrogate key unique key alternate key composite key compound key


What is the function of a Foreign Key in SQL?

A Foreign Key in SQL is used to establish a relationship between two tables. It ensures referential integrity by enforcing that values in a column (or columns) in one table must match the values in a primary key in another table. This helps maintain consistency and data integrity across linked tables.


What does the term foreign key mean in databases?

A foreign key is a field in a database table that is used to establish a relationship with another table. It ensures referential integrity by enforcing a link between two tables based on a matching key. This key is typically a primary key in the referenced table.


Is foreign key a non key attribute?

a key to a different table


Can a primary key be a foreign key?

Yes, a primary key can also be a foreign key. This is known as a composite key, where one or more columns in a table are both primary keys for that table and also act as foreign keys linking to another table.