|
Home > Archive > SQL server exams > January 2003 > 70-229 Question - help needed
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
70-229 Question - help needed
|
|
| dipikapala 2003-01-15, 7:44 pm |
| I came across the following questions in one of the braindumps, abit confused abt the answer. Please help...I think the answer is B while the ans provided is C.
You are a database consultant. You have been hired by a local dog breeder to develop a database. This database
will be used to store information about the breeder's dogs. You create a table named Dogs by using the following
script:
CREATE TABLE[dbo].[Dogs]
(
[DogID] [int] NOT NULL,
[BreedID] [int] NOT NULL,
[Date of Birth] [datetime] NOT NULL,
[WeightAtBirth] [decimal] (5, 2) NOT NULL,
[NumberOfSiblings] [int] NULL,
[MotherID] [int] NOT NULL,
[FatherID] [int] NOT NULL
)_on [PRIMARY]
GO
ALTER TABLE [dbo].[Dogs] WITH NOCHECK ADD
CONSTRAINT [PK_Dogs]PRIMARYT KEY CLUSTERED
(
[DogID]
) ON [PRIMARY]
GO
You must ensure that each dog has a valid value for the MotherID and FatherID columns. You want to enforce this rule
while minimizing disk I/O.
A. Create an ALTER INSERT trigger on the dogs table that rolls back the transaction if the MotherID or FatherID
column is not valid.
B. Create a table-level CHECK constraint on the MotherID and FatherID columns.
C. Create two FOREIGN KEY constraints, create one coinstraint on the MOtherID column and one constraint on the
FatherID column. Specify that each constraint reference the DogID column.
D. Create a rule and bind it to the MotherID. Bind the same rule to the FatherID column.
Ans: C | |
| naresh_sky 2003-01-16, 1:12 am |
| hi dipikapala...
well the options u prescribe all
going to work in there own set of areas.
as far as i know .
the rule, check constraint the trigger
all going to work for the check of
integrity mean to compare for a set
of values and verify wether the value
is with in the range.
i beleive the answer c is correct if u
truly want to implement the consistency
and relation in ur db.
cheers
naresh | |
|
| Hi Dipikapala its no confusion at all with that Q.
If we get on to the basics of constraints then, CHECK CONSTRAINTS are used to restrict the user input to a specific value in the table.
E.g.
we want to restrict the user to input only M (Male) and F (Female). Or many other cases as such.
So, as regard with the question U mentioned FOREIGN KEY CONSTRAINTS would be the right choice as the requirement here is to maintain integrity [valid values] across tables. |
|
|
|
|