Database - Define Primary key and Foreign key

Define Primary key and Foreign key.

- A column or combination of columns that identify a row of data in a table is Primary Key.
- A key in a table that identifies records in other table in called a foreign key.

Primary key and unique key

-Both are used to provide uniqueness of the column.
- Primary key creates clustered key on the column by default whereas unique key creates non-clustered index by default.
- Primary doesn't allow NULL values whereas unique key can allow one NULL value.

Define Primary key and foreign key.

- Primary Key: Primary key is used for unique identification of each row in a table. Unique and not null values only are accepted to persist in primary key.

- Foreign Key: Foreign Key identifies a column with the primary key column of another table (parent table) for storing data. The values in the foreign key must be the values of primary key of other columns. Thus it ensures the data integrity – correct data.
Database - Define alternate key
There can be a key apart from primary key in a table that can also be a key. This key may or may not be a unique key.....
Database - Define SQL
Structured query language, SQL is an ANSI standard language that provides commands to access and update databases....
Database - Explain the difference between DBMS and RDBMS
DBMS offers organized way of storing, managing and retrieving information......
Post your comment