Saturday, 11 June 2016

Question and Answers in Sql Server - Part 3

In This post Let we see some important question and answers in Sql Server, which is a continuation of previous post.

12. What are the keys present in the SQL SERVER ?
        Keys present in Sql Server Click here to read.

13 What are the Constraint's present in the SQL SERVER ?

        Default constraint, Check Constraint, Unique Constraint , Null Constraint.

        Default constraint : The name of constraint itself explain the usage , it specifies a default value for a column if the value is not inserted.

        Check Constraint : This constraint  check the user inserted value against the check condition present in the table.

        Unique Constraint : Is use to identify the row in unique like primary key.

         Null Constriant : It allows the null values to the value of a column in table.


  PRIMARY KEY    -- unique constraint   (for unique identify the row.)

  CHECK(age > 20 AND age < 50-- check constraint (while user insert a value in                                   a row this check constraint check the value                                       before insert)

  DEFAULT(25000)  -- Default constraint (if user doesnt enter the value for this                      column this default value will be taken and inserted)

  NULL     -- Null constraint allows null value if user doesnt enter the                           value

 id    INT PRIMARY KEY,   
 age   INT CHECK(age > 20 AND age < 50), 
 salary INT DEFAULT(25000),             
 passportno INT NULL                

INSERT INTO cons_emp (id,age) VALUES (1, 25)

Query to find out the constraint present in a DB


The Database is work around with main four operation CRUD, To do that following keywords are important.


These keywords are used to operate in tables for data.

Table and Database are the two words where are the keywords are working on.

14. What are objects is used to work on Tables and database to process the data ?
       Stored Procedure

15 What are Mostly commonly keywords used in Database to do operations ?
       Create Database
       Alter  Database
       Drop Database

No comments:

Post a Comment