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 / sowndharya-bca gvg colleg

constraints are enforced on data being stored in a table
1-primary key constraint
2-foreign key constraint
3-unique key constraint


other constraints~~~~:
business rule constraints
column level constraints
table level constraints

Is This Answer Correct ?    1 Yes 0 No

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

Answer / agasaud

Constraints are Boundaries or Rules To Set on a Table.

Types of Constraints are :

Primary Key
Uniwue Key
Check Constraints
Default Constraints
Not Null
References

Is This Answer Correct ?    1 Yes 0 No

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

Answer / ds

Constraints help to l

Is This Answer Correct ?    1 Yes 1 No

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

Answer / balamurugan

only five constraint in sql server

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

Is This Answer Correct ?    1 Yes 1 No

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

Answer / nivetha sri

Constraint are the certain condition which is used to
limit the data in the table.It can used before creating the
table and after creating the table.
TYPES OF CONSTRAINTS
1] Primary key
2]Foreign key
3]Unique key
4]Check
5]Not Null
6]Default

Is This Answer Correct ?    1 Yes 1 No

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

Answer / kannan

SQL Server constraints allow you to enforce rules in your
database. These rules may affect business logic, database
integrity and/or table structures. Each one plays an
important role in your database architecture. The six types
of constraints supported by Microsoft SQL Server include:

UNIQUE constraints allow SQL Server administrators to
specify that a column may not contain duplicate values. When
you create a new UNIQUE constraint, SQL Server checks the
column in question to determine whether it contains any
duplicate values. If the table contains preexisting
duplicates, the constraint creation command fails.
Similarly, once you have a UNIQUE constraint on a column,
attempts to add or modify data that would cause duplicates
to exist also fail.
CHECK constraints allow you to limit the types of data
that users may insert in a database. They go beyond data
types and allow you to define the specific values that may
be included in a column.
DEFAULT constraints allow you to specify a value that
the database will use to populate fields that are left blank
in the input source. They're a replacement for the use of
NULL values that provide a great way to predefine common
data elements.
NOT NULL constraints allow you to specify that a column
may not contain NULL values. When you create a new NOT NULL
constraint on a database column, SQL Server checks the
column's current contents for any NULL values. If the column
currently contains NULL values, the constraint creation
fails. Otherwise, SQL Server adds the NOT NULL constraint
and any future INSERT or UPDATE commands that would cause
the existence of a NULL value fail.
PRIMARY KEY constraints specify fields that uniquely
identify each record in the table. It can either be a normal
attribute that is guaranteed to be unique (such as Social
Security Number in a table with no more than one record per
person) or it can be generated by the DBMS (such as a
globally unique identifier, or GUID, in Microsoft SQL
Server). Primary keys may consist of a single attribute or
multiple attributes in combination.
FOREIGN KEY constraints are fields in a relational
database table that match the primary key column of another
table. Foreign keys can be used to cross-reference tables.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / raghunath k

Constraints are some rules that are inforced on the data object.
there are five types of costriants in SQL, they are
1. NOT NULL CONSTRAINTS.
2. UNIQUE CONSTRAINTS.
3. PRIMARY KEY CONSTRAINTS.
4. FOREIGN KEY CONSTRAINTS.
5. CHECK CONSTRAINTS.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / shreevats

Constraints are the conditions which allows to restrict the invalid or inconsistent data in the tables.

Types of Constraints
1.Not null:Not null make any column as mandatory and it will not allows the null values.
2.Unique:It will not allows duplicate values.
3.Primary Key:A PK is used to identify a record uniquely in a table.
PK=UNIQUE+NOT NULL
4.Foreign Key or Referential Integrity constraint
:It creates the relationship between any two tables.
5.Check: It is used for enforcing business validation.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / rehan khan

constraint enforces rules at the table level and prevent the deletion of a table if there are dependencies .

constraint type:

primary key
foreign key
unique
not null
null
check
constraints can be defined at the time of table creation or after table has been created.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / tosh

constraint is a mechanism applied on a column to restrict the user not to enter null values,duplicate and invalid data.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is ms sql server index?

0 Answers  


What kind of problems occurs if we do not implement proper locking strategy?

0 Answers  


where can you add custom error messages to sql server? : Sql server administration

0 Answers  


Explain about system database?

0 Answers  


How To delete duplicate record from a particular table?

12 Answers   eXensys, Foxfire,






Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot?

1 Answers  


What is the use of keyword with encryption.

0 Answers  


What are the results of running this script?

0 Answers  


What are the different types of columns types constraints in the sql server?

0 Answers  


What is mscorsvw.exe - process - microsoft .net framework ngen?

0 Answers  


What are the advantages of user-defined functions over stored procedures in sql server?

0 Answers  


How many instances per computer are there in sql server 2000?

0 Answers  


Categories