Hello Techie Guys.
In this article discuss about the Constraints in SQL. Why it is required for any developer before create the table or fully database for our projects or application. Why it's very import phase for any type database layout or design for a our application or project.
Constraints
Constraints means in SQL We are applying some condition or restriction before any type of data insertion or updating on database. When we wants to insert or update the data in database so we are checking some conditions when we create the table so we define the condition.
SQL Constraints
- NOT NULL
- Unique
- Primary Key
- Foreign Key
- Check
- Default
NOT NULL- If we create a table with NOT NULL Constraints. So that mean in this particular column value we can not empty inserted because that's show error so please see in below picture.
First We create a table with Not Null Constraints:-
Picture for create table with NOTNULL Constraints
Now Try to insert with null value
Unique - If we create or apply with any column unique constraint that's mean this column all row values is unique. Below images show the output.
Now create table with Unique constraints
Now try to some data insert with unique constraints
0 Comments
thanks for your suggestion and improving quality of the content