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

Answer Posted / awadhesh

You can place constraints to limit the type of data that can go into a table. Such constraints can be specified when the table when the table is first created via the CREATE TABLE statement, or after the table is already created via the ALTER TABLE statement.

Common types of constraints include the following:

NOT NULL Constraint: Ensures that a column cannot have NULL value.
DEFAULT Constraint: Provides a default value for a column when none is specified.
UNIQUE Constraint: Ensures that all values in a column are different.
CHECK Constraint: Makes sure that all values in a column satisfy certain criteria.
Primary Key Constraint: Used to uniquely identify a row in the table.
Foreign Key Constraint: Used to ensure referential integrity of the data.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is filter index?

702


Can a table have 2 primary keys?

720


How to create view in stored procedure sql server?

694


How to add the custom code in Report?

112


What is Command line parameters in PLSQL.?

765






How many types of objects are there?

685


What is mean by candidate key?

750


What is an execution plan? When would you use it?

733


What are the different types of indexes?

770


How to define output parameters in stored procedures?

713


What are indexes in sql?

772


What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?

669


How does clustered and non clustered index work?

681


How to download and install the scaled-down database adventureworkslt?

786


How to create a user to access a database in ms sql server using "create user" statements?

726