What are the SQL constraints?
Ans:
SQL constraints are used to specify rules for the data in a table. Constraints are used to limit the type of data that can go into a table
1. NOT NULL Constraint − Ensures that a column cannot have NULL value.
2.
DEFAULT Constraint − Provides
a default value for a column when none is specified.
3.
UNIQUE Constraint − Ensures
that all values in a column are different.
4.
PRIMARY Key − Uniquely
identifies each row/record in a database table.
5.
FOREIGN Key − Uniquely
identifies a row/record in any of the given database table.
6.
CHECK Constraint − The CHECK
constraint ensures that all the values in a column satisfies certain
conditions.
7.
INDEX − Used to create and
retrieve data from the database very quickly.(
No comments:
Post a Comment