What is data integrity? Explain constraints?



What is data integrity? Explain constraints?..

Answer / vampire007

A constraint is a property assigned to a column or the set
of columns in a table that prevents certain types of
inconsistent data values from being placed in the column
(s). Constraints are used to enforce the data integrity.
This ensures the accuracy and reliability of the data in
the database. The following categories of the data
integrity exist:


Entity Integrity
Domain Integrity
Referential integrity
User-Defined Integrity

Entity Integrity ensures that there are no duplicate rows
in a table.
Domain Integrity enforces valid entries for a given column
by restricting the type, the format, or the range of
possible values.
Referential integrity ensures that rows cannot be deleted,
which are used by other records (for example, corresponding
data values between tables will be vital).
User-Defined Integrity enforces some specific business
rules that do not fall into entity, domain, or referential
integrity categories.

Each of these categories of the data integrity can be
enforced by the appropriate constraints. Microsoft SQL
Server supports the following 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.

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 ?    95 Yes 9 No

Post New Answer

More SQL Server Interview Questions

What are the system database in sql server 2005?

0 Answers  


How to test odbc dsn connection settings?

0 Answers  


What is the sql server agent?

0 Answers  


What are sql server functions?

0 Answers  


write a query for list of owner who are having multiple bikes in below table 1 shanker pulsar 2 shanker Honda 3 shanker car 4 Balu pulsar 5 Balu Honda 6 Balu car 7 Shyam pulsar 8 Jaya Honda 9 Deepa car 10 vasu car

12 Answers   Cognizant, TCS,






Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?

0 Answers  


Do you know what are different types of replication in sql server?

0 Answers  


What is index fragmentation in ms sql server?

0 Answers  


What is sql collation?

0 Answers  


Does a server store data?

0 Answers  


What are logical database components? : SQL Server Architecture

0 Answers  


What is 4nf in normalization form?

0 Answers  


Categories