what is sql-constraints | type of SQL Constraints
#sql #sqlconstraints #typeConstraints #oracleConstraints
In table level constraints are declared after declaring all columns. Use table level when more than one column participates in constraint declaration.
NOT NULL constraint allows to specify that a column can not contain any NULL value.
NOT NULL can be used to CREATE and ALTER a table.
The UNIQUE constraint does not allow to insert a duplicate value in a column.
More than one UNIQUE column can be used in a table.
A FOREIGN KEY in L creates a link between two tables by one specific column of both table.
The specified column in one table must be a PRIMARY KEY
and referred by the column of another table known as FOREIGN KEY.
A CHECK constraint controls the values in the associated column.
The CHECK constraint determines whether the value is valid
or not from a logical expression.
This is Example primary key Constrains:
CREATE TABLE Student(roll_no varchar(7),name varchar(20) ,address
varchar(50) ,tot_marks int, branch varchar(6), PRIMARY KEY(roll_no));
Here we Learn What is Sql Constarints ?
What is type of SQL Constraints?
It Is clear we are using constraints to restrict certain activity on data of Table.
If You have any doubt reach out to us