Data integrity is an important feature in SQL Server. When used properly, it ensures that data is
accurate, correct, and valid. It also acts as a trap for otherwise undetectable bugs within applications.
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 links 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.
Saturday, May 10, 2008
What is data integrity? Explain constraints?
Labels:
SQL Interview Questions
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(41)
-
▼
May
(20)
- Which command using Query Analyzer will give you t...
- What is SQL server agent?
- Can a stored procedure call itself or recursive st...
- What is @@ERROR?
- What is Raiseerror?
- What is log shipping?
- What is the difference between a local and a globa...
- What command do we use to rename a db?
- What is sp_configure commands and set commands?
- What are the different types of replication? Explain.
- What are the OS services that the SQL Server insta...
- What are three SQL keywords used to change or set ...
- What does it mean to have quoted_identifier on? Wh...
- What is the STUFF function and how does it differ ...
- Using query analyzer, name 3 ways to get an accura...
- How to rebuild Master Database?
- What is the basic functions for master, msdb, mode...
- What are primary keys and foreign keys?
- What is data integrity? Explain constraints?
- What are the properties of the Relational tables?
-
▼
May
(20)
No comments:
Post a Comment