Follow Us

LightBlog

Breaking

Tuesday, June 12, 2018

What is Constraints ? Null, Not Null, Primary key, Unique Key ,Check ,Default, Foreign Key


 1 .What is  Constraints ?
  Definition:   constraint  are rules and restriction  applied on a column  or a table  such as unwanted  data  can't be inserted into a table .

Types of Constraints :

1.  Null
2. Not Null
3.  Primary key
4.  Unique key
5. Check Constraints
6.  Default Constraints
7.  foreign key

                        ALT+ F1 - Press

                                              (1)  Null Constraints

  Null:- Allows null values.
  Example:
                 Create table tabl_null
                 (
                  id int,
                   name varchar(50),
                  sal int
                   ) 
      

      Every column by default allows null values. 
                                        
                                        (2) Not Null 

   Not Null: - We don't allows null values.



 
     

No comments:

Post a Comment