ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Databases >> SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions (2040)
 SQL Server interview questions  SQL Server Interview Questions (1080)
 MS Access interview questions  MS Access Interview Questions (25)
 MySQL interview questions  MySQL Interview Questions (194)
 Postgre interview questions  Postgre Interview Questions (6)
 Sybase interview questions  Sybase Interview Questions (22)
 DB Architecture interview questions  DB Architecture Interview Questions (5)
 DB Administration interview questions  DB Administration Interview Questions (213)
 DB Development interview questions  DB Development Interview Questions (53)
 SQL PLSQL interview questions  SQL PLSQL Interview Questions (775)
 Databases AllOther interview questions  Databases AllOther Interview Questions (107)
Question
What are constraints? Explain different types of 
constraints?
 Question Submitted By :: SQL-Server
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
constraint is a rule which can not be voilated by end users.
Different types of constraints are available.They are:-
1)default constraint:-which is used to define a default
value.
2)primary key:-the key which does not allows duplication
and null values.
3)foreign key:-the key used to refer primary key defined
field in another table and it allows duplication.
4)null:-which allows NULL values.
5)not null:-which does not allows NULL values.
6)unique key:-which does not allows duplication but allows
NULL values.
 
Is This Answer Correct ?    239 Yes 52 No
Haritha
 
Answer
# 2
Constraints are the constraints which can provide on the
column data.The types of constraints are
1).Domain Integrity constraints
EX:Check
2).Entity Integrity constraints
Ex:Unique,Primary key
3).Referential Integrity constraints
EX:Foreignkey
 
Is This Answer Correct ?    108 Yes 34 No
Satyanarayana
 
 
 
Answer
# 3
Including these it also contains check constraint.
check constraint:-It specifies a range of values witn in
which the attribute should take
 
Is This Answer Correct ?    92 Yes 40 No
Haritha
 
Answer
# 4
Constraint : To Restrict the voilation of irrelegular data
and maintain data integrity.

Primary key
Unique Key
NotNull
Forigen Key
Check
 
Is This Answer Correct ?    65 Yes 37 No
Hari
 
Answer
# 5
Constraint mostly restrict the user from entering violated
data into the table..

Various types of constraints are:
Primary Key Constraint
Foreign Key Constraint
Unique key Constraint
Check Constraint
NOT NULL Constraint
 
Is This Answer Correct ?    38 Yes 18 No
Smita
 
Answer
# 6
. Primary Key Constraint
. Foreign Key Constraint
. Unique Key Constraint
. Check Constraint
 
Is This Answer Correct ?    36 Yes 25 No
Mangesh
 
Answer
# 7
3 basic types
1.entity constraint:
check
not null
null
2.domain constraint:
unique
primary
composite primary key
3.referential constraint:
integrity
foreign
 
Is This Answer Correct ?    26 Yes 21 No
Rev
 
Answer
# 8
Constraints are used to restrict or protect the data and
accessing from the table
There are 5 types of constraints available,
That,
1.Primary-which is not allowed duplication and Null values
2.Unique-Which is also Not allowed duplication But It is
allowed one single null values
3.Foreign - Which is allowed duplication and Null values.
But It refers Value from primary Key table to its own table
Value.
4.Check Constratints
5.Not null
 
Is This Answer Correct ?    10 Yes 5 No
Kannan G
 
Answer
# 9
Constraints enable the RDBMS enforce the integrity of the
database automatically, without needing you to create
triggers, rule or defaults.

Types of constraints:
PRIMARY KEY
UNIQUE
FOREIGN KEY
CHECK
NOT NULL

A PRIMARY KEY constraint is a unique identifier for a row
within a database table. Every table should have a primary
key constraint to uniquely identify each row and only one
primary key constraint can be created for each table. The
primary key constraints are used to enforce entity
integrity. ( Entity integrity is an integrity rule which
states that every table must have a primary key and that
the column or columns chosen to be the primary key should
be unique and not null)

A UNIQUE constraint enforces the uniqueness of the values
in a set of columns, so no duplicate values are entered.
The unique key constraints are used to enforce entity
integrity as the primary key constraints.

A FOREIGN KEY constraint prevents any actions that would
destroy link between tables with the corresponding data
values. A foreign key in one table points to a primary key
in another table. Foreign keys prevent actions that would
leave rows with foreign key values when there are no
primary keys with that value. The foreign key constraints
are used to enforce referential integrity.

A CHECK constraint is used to limit the values that can be
placed in a column. The check constraints are used to
enforce domain integrity.

A NOT NULL constraint enforces that the column will not
accept null values. The not null constraints are used to
enforce domain integrity, as the check constraints.
 
Is This Answer Correct ?    3 Yes 2 No
Rahul Shrivastava
 
Answer
# 10
constraint define rules that must be followed to maintain
consistency and correctness of data.a constraint can either
be created while creating a table or can be added later.
constraint can be divided into the following types:--
(1)primary key constraint.
(2)unique constraint.
(3)foreign key constraint.
(4)check constraint.
(5)default constraint.
 
Is This Answer Correct ?    1 Yes 0 No
Ravi Gupta
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
how to find the second salary? HCL 10
What is SQL Profiler what is the use of it? 247Customer 2
hi friends please answer this question ASAP:- how to count the no. of employee in a each department or no. of employee in each location by using emp/dept table Indecomm 6
can you any body tell me which service pack is installed in the sql server?   3
What is Online Index Rebuild Operation?   1
I am Having tables T1 and T2 both having same data how to check (or) compare the data in both table are same?   3
we have emp table like Ename,EDOJ,EDOB with Column structure.but we want to know the employee Age.How? Any Body Plz   6
What is the difference between Stored Procedure , Function and Package, 1. how many blocks in Package and what are they. IBM 5
Can some one please help with a query which will take only max value of a column in a join.   2
I am using SQL Server 2005, I have some select and update statements in my query with WHERE clause I want to prevent these queries from SQL injection attacks. What are the steps and precautions to be taken for SQL Injection attacks? Does anybody have suggestions? Thanks in advance,   2
How do you find the error, how can you know the number of rows effected by last SQL statement?   2
Difference b/w Clustered & non-clustered index? Not the bookish definition, but how they internally works in SQL Server? United-Healthcare 1
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com