what is Constraint? How many types of constraints in SQL ?

Answers were Sorted based on User's Feedback



what is Constraint? How many types of constraints in SQL ?..

Answer / mudit

Constraint are the rules enforced on data columns on table.

Five type of constraints
Primary key
Unique Key
Foreign Key
Not Null
Check

Is This Answer Correct ?    338 Yes 56 No

what is Constraint? How many types of constraints in SQL ?..

Answer / scornguy

Constraints are used to limit the type of data that can go
into a table.

NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
CHECK
DEFAULT

Is This Answer Correct ?    225 Yes 29 No

what is Constraint? How many types of constraints in SQL ?..

Answer / kumari

Constraint are the rules enforced on data columns on table

types of constraints:

PRIMARYKEY
FOREIGN KEY
NOT NULL
UNIQUE KEY
CHECK
DEFAULT
Check

Is This Answer Correct ?    111 Yes 33 No

what is Constraint? How many types of constraints in SQL ?..

Answer / bimaleswar patel

Constraints are used to limit the type of data that can go
into a table.
two basic types of constraints are there
1.column level
2.table level
the difference is that column level constraints are apply
only to one column where as table level constraints are
apply to whole table
Constraints are declare at the time of table creation using
CREATE TABLE command

there are 6 constraints used in oracle
1.NOT NULL
2.UNIQUE
3.PRIMARY KEY
4.CHECK
5.DEFAULT
6.REFERENCES

Is This Answer Correct ?    96 Yes 24 No

what is Constraint? How many types of constraints in SQL ?..

Answer / yashwanth

constraints are the rules enforced on data columns on a
table
use:constraints are used to limit the type of data that
can go in to a table

there are some constraints
a primarykey constraint
a unquekey constraint
a foreinkey constraint
a check constraint
a not null constraint
a default constraint

Is This Answer Correct ?    47 Yes 13 No

what is Constraint? How many types of constraints in SQL ?..

Answer / bose

constraint is a mechanism it is used to prevent the invalid
data entry in to the table is called constraint

Is This Answer Correct ?    43 Yes 9 No

what is Constraint? How many types of constraints in SQL ?..

Answer / shankar k

Constraint are used to table columns validations.
there are some constraints.

Primary key,
Foreign Key,
Not Null,
Check,
Unique Key,
default

Is This Answer Correct ?    43 Yes 10 No

what is Constraint? How many types of constraints in SQL ?..

Answer / vijaya

Constraints are rool of data integrity.

Types of Constraints are:
1)Not Null
2)Unique
3)Primary Key
4)Check
5)References.

Is This Answer Correct ?    39 Yes 11 No

what is Constraint? How many types of constraints in SQL ?..

Answer / srinivas

Constraint are the rules enforced on data columns on table



Five type of constraints
Primary key
Unique Key
Foreign Key
Not Null
Check

Is This Answer Correct ?    28 Yes 14 No

what is Constraint? How many types of constraints in SQL ?..

Answer / jayhar

There are a number of different ways to implement
constraints, but each of them falls into one of these three
categories:
Entity constraints,
Domain constraints,
Referential integrity constraints.

Domain Constraints: A Domain constraint deals with one or
more columns. It is important to ensure that a particular
column or a set of columns meets particular criteria. When
you insert or update a row, the constraint is applied
without respect to any other row in the table. The focus is
on the data that is in the column. These kinds of
constraints will resurface when we deal with Check
constraints, Default constraints and rules and defaults.

Entity Constraints: Entity constraints are all about
individual rows. This constraint ignores the column as a
whole and focuses on a particular row. This can be best
exemplified by a constraint that requires every row to have
a unique value for a column or a combination of columns.
This is to ensure that for a particular row, the same value
does not already exist in some other row. We’ll see this
kind of constraint in dealing with Primary key and Unique
constraints.

Referential Integrity Constraints: Referential integrity
constraints are created when a value in one column must
match the value in another column. It can either be in the
same table or more typically, a different table. For
example, we are taking orders for a product, and we accept
credit payment. But we will accept only a few standard
credit card companies like Visa, MasterCard, Discover, and
American Express. Referential integrity constraints allow
us to build what we would call a domain table. A domain
table is table whose sole purpose is to provide a limited
list of acceptable values. In our case we have a CreditCard
table with CreditCardID, and CreditCard as fields. We can
then build one or more tables that reference the
CreditCardID column of our domain table. With referential
integrity, any table that is defined as referencing our
CreditCard table will have to have a column that matches up
to the CreditCardID column of our CreditCard table. For
each row we insert into the referencing table, it will have
a value that is in our domain list. We will see more of
this when we learn about Foreign key constraints.

Is This Answer Correct ?    12 Yes 0 No

Post New Answer

More SQL Server Interview Questions

As per your opinion what are the five top responsibilities of a dba? : sql server database administration

0 Answers  


What are the encryption mechanisms in sql server?

0 Answers  


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

0 Answers  


What is similarity and difference between truncate and delete in sql?

0 Answers  


Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?

0 Answers  






In what three ways is the return statement used in a stored procedure?

0 Answers  


What is the difference between primary key and unique constraints?

0 Answers  


How to enforce security in sql server? : sql server security

0 Answers  


what is an extended stored procedure? Can you instantiate a com object by using t-sql? : Sql server database administration

0 Answers  


What are the instances when triggers are appropriate?

0 Answers  


What is lock escalation and what is its purpose?

0 Answers  


what are isolation levels? : Sql server database administration

0 Answers  


Categories