|
Answer» Constraints in SQL are the limits or rules that we can APPLY to the different types of data in a given table. Constraints are used to ensure the accuracy and RELIABILITY of the data in the table. The constraints in SQL are as follows: - NOT NULL: This particular constraint informs us that ONE cannot store a null value within a column.
- UNIQUE: When specified with a column, this constraint informs that all the VALUES in a given column must be unique.
- PRIMARY KEY: A primary key is a field that can uniquely identify each row in a table. This is typically used to specify a field in a table as the primary key.
- FOREIGN KEY: A Foreign key is a field that can uniquely identify each row in another table.
- CHECK: This constraint helps us to validate the values of a column to attain a particular condition.
- DEFAULT: This constraint gives a default value for the column when the user does not specify a value.
|