Foreign Keys
The thing that defines the physical relationship between two tables in a database is called:
Foreign Key Constraint
Unique keys guaranteed data is unique within a given column.
Primary keys also guaranteed the uniqueness within a column but They guarantee that each row in a table can be identified and those links from one table to another.
If NO Foreign Key Constraint exists between two tables, it is possible to accidentally record data in a foreign key column that does not have a matching value in the primary key table.
TRUE
Primary keys also work together with the last kind of key, foreign keys.
To give us the ability to relate two tables of data together on common data values.
What are Foreign Keys?
They are columns that contain data which relate to the Primary Key in another table
There are two facets to creating a foreign key,
first, the database designer has to match the columns properly in both tables.
You can think of a constraint as a rule that the database has to enforce,
once the database is instructed to enforce a foreign key constraint between two tables, it will not allow the value to be added to a table containing a foreign key unless the value also exists in a table with the primary key.
Without foreign key constraints,
our data lacks referential integrity.
You can think of a foreign key as a
pointer or reference from one table to another.
Being able to ensure the validity of our data relationships is called
referential integrity
Last, we learned that foreign key constraints are
the way that database is enforce these relationships.