The relational database is a collection of an organised set of tables from which data can be accessed easily.
What is a Record?
What is Field?
What is a Column ?
In Relational table, a column is a set of value of a particular type. The term Attribute is also used to represent a column. For example, in Employee table, Name is a column that represent names of employee.
- Specifies that no two distinct records have same value. (Combination of no two records will have same data)
- Super key may have redundant attributes.
In order to be eligible for a candidate key it must pass certain criteria.
- It must contain unique values
- It must not contain null values
- It contains the minimum number of fields to ensure uniqueness
- It must uniquely identify each record in the table
- Once your candidate keys have been identified you can now select one to be your primary key
If we use multiple attributes to createa Primary Key then that Primary Key is called Composite Key. In thisall the other columns that take part in the combination process arenot simple keys.
- It uniquely identifies each record in a database table.
- Primary keys must contain unique values.
- A primary key column cannot contain NULLvalues.
- Column level constraints : limits only column data
- Table level constraints : limits whole table data
- NOT NULL
- PRIMARY KEY
- FOREIGN KEY
Primary Key Constraint
Foreign Key Constraint
Example using FOREIGN KEY constraint at Table Level
- On Delete Cascade : This will remove the record from child table, if that value of foriegn key is deleted from the main table.
- On Delete Null : This will set all the values in that record of child table as NULL, for which the value of foriegn key is elected from the main table.
If you found it is good, please like or comment below. Do visit for more articles.Thank You..!!