Please enable JavaScript.
Coggle requires JavaScript to display documents.
Keys - Coggle Diagram
Keys
2.Foreign key
A foreign key establishes a relationship between two tables by referencing the primary key of another table.
-
3.Unique key
A unique key, similar to a primary key, However allow null value unlike primary key. Unique keys are used to ensure that certain columns or combinations of columns do not contain duplicate values.
-
-
5.Composite Key
A composite key, also known as a composite primary key or compound key, is a primary key that consists of two or more columns. It is used when a single column cannot uniquely identify rows.
Room Number and Floor: In a hotel database, the combination of room number and floor can uniquely identify each room. Customer Name and Phone Number: In some cases, combining a customer's name with their phone number can uniquely identify customers. Location Coordinates (Latitude and Longitude): When mapping geographic locations, combining latitude and longitude values forms a composite key.
1.Primary key
A primary key uniquely identifies each record in a table. It enforces entity integrity, meaning that each value in the primary key column(s) must be unique and not null
-
Primary key can be more than one table CONSTRAINT PK_TableName PRIMARY KEY (Column1, Column2)
4.Alternate Key
An alternative key is a candidate key that is not chosen as the primary key. It represents additional unique identifiers in a table.
6.Super Key
A super key is any set of attributes (columns) that can be used to uniquely identify a row. It serves as a basis for defining candidate keys.
-
7.Candidate Key
A candidate key is a minimal super key, meaning it is a unique identifier with no unnecessary attributes. One candidate key is typically chosen as the primary key.
like a person's Social Security Number (SSN) or a product's barcode. A unique identifier for automobiles. A unique identifier for products in inventory.