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 the difference between a clustered index and a non-clustered index?

536


What purpose does the model database server?

657


Can two tables share a primary key?

522


How can you set the threshold at which sql server will generate keysets asynchronously?

565


How do I open port 1433?

532






How can you tell if a database object is invalid?

619


What are different types of replication in sql server?

572


What are the different types of join?

573


Write an sql query to find first weekday of the month?

488


How can I create a report based on a query? : sql server management studio

564


What is Sqlpaging in SqlServer 2005 ?

664


What is difference between index seek vs. Index scan?

626


Explain acid?

615


How to create a user name in a database?

592


What is pessimistic concurrency?

546