Which of the following should he use to accomplish the task?

John works as a Database Administrator for www.company.com Inc. The company has a SQL server 2008
database. John wants to define a valid data while adding or updating an entry in a table of a relational
database. Which of the following should he use to accomplish the task?

John works as a Database Administrator for www.company.com Inc. The company has a SQL server 2008
database. John wants to define a valid data while adding or updating an entry in a table of a relational
database. Which of the following should he use to accomplish the task?

A.
Locking hints

B.
Check constraint

C.
Stored procedure

D.
View

Explanation:
A check constraint is a condition that defines valid data when adding or updating an entry in a table of a
relational database. A check
constraint is applied to each row in the table. Theconstraint must be a predicate. It can refer to a single or
multiple columns of the table. The
result of the predicate can be either TRUE, FALSE, or UNKNOWN, depending on the presence of NULLs. If
the predicate evaluates to
UNKNOWN, then the constraint is not violated and the row can be inserted or updated in the table.
This is contrary to the predicates in the
WHERE clauses in the SELECT or UPDATE statements.
Answer C is incorrect. A stored procedure is a collection of T-SQL statement or a reference to common
language runtime (CLR) method
that can return as well as take the user-supplied parameters. Procedures can be created for permanent use or
for temporary use within a
session as local temporary procedure, or global temporary procedure for temporary use within all sessions.
Answer D is incorrect. A view is a type of virtual table. The data accessible through a view is not stored in the
database as a distinct
object. Views are created by defining a SELECT statement. The result set of the SELECT statement formsthe
virtual table. A user can use this
virtual table by referencing the view name in SQL statements in the same way a table is referenced.
A view does not contain data of its own
but derives (or dynamically displays) data from other tables or views on the basis of the query specified for the
view. The tables from which a

view derives data are known as base tables. Operations on a view affect its base tables.
The syntax for creating a view is as follows:
CREATE VIEW <VIEW name> AS
SELECT <attributes>
FROM <Tablename>
WHERE <condition>
Answer A is incorrect. Locking hints can be particular for individual table references in the INSERT, SELECT,
DELETE, and UPDATE
statements. The hints state the type of locking or row versioning the instance of the Microsoft SQL Server
Database Engine used for the table
data. Table level locking hints are used when a finer control of the types of locks acquired on an object is
required. These locking hints take
priority over the current transaction isolation level for the session.



Leave a Reply 0

Your email address will not be published. Required fields are marked *