Which action should you take?

Correct Answer for the following Question is given below

You are a database developer on an instance of SQL Server 2008. You have an Employee table created with the following statement:CREATE TABLE Employee (EmpID int IDENTITY(1,1) PRIMARY KEY,LastName varchar(35) NOT NULL,FirstName varchar(25) NOT NULL,HireDate datetime,Salary money,MgrID int);The MgrID column will contain the EmpID associated with each employee’s manager. You want to create a self-referencing relationship to support this.Which action should you take?A FOREIGN KEY constraint is used to establish a relationship between two tables or to establish a self-referencing relationship within a single table.You can create a FOREIGN KEY CONSTRAINT using the ALTER TABLE statement:ALTER TABLE EmployeeADD FOREIGN KEY (MgrID) REFERENCES Employee (EmpID)A CHECK constraint consists of a Boolean expression that evaluates to either TRUE or FALSE. If the expression evaluates to TRUE, the value is allowed for the column, and if the expression evaluates to FALSE, the value is not allowed for the column. CHECK constraints can be defined at the table level or column level, but only CHECK constraints defined at the table level can use columns other than the constrained column in the constraint expression.DML triggers contain Transact-SQL code that executes when a DML operation, such as an INSERT, UPDATE, MERGE, or DELETE, is performed. INSTEAD OF triggers fire in place of the triggering operation, and AFTER triggers fire after the triggering operation completes successfully. You might use a DML trigger to prevent the original triggering operation or to perform additional or alternative actions.

Question:

Which action should you take?

Options:

Create a DML trigger.

Create a FOREIGN KEY constraint on the EmpID column.

Create a FOREIGN KEY constraint on the MgrID column.

Create a CHECK constraint on the MgrID column.

Correct Answer

The Correct Answer for this Question is

Create a FOREIGN KEY constraint on the MgrID column.

Explanation

The Question – Which action should you take? has been answered correctly and answers for the question is Create a FOREIGN KEY constraint on the MgrID column.

More about these Exams

These Exam Questions and the order of these questions keep changing. but the answers are obviously same. so if you don’t find a question after another we suggest you search it in the search box and we are sure you’ll find it. you can bookmark this site for Quick access in future.

We hope you found it helpful don’t forget to leave a comment if you feel a need to correct or ask we’re always here to help.

you can find more here at mnccertified

Feel free to contact via comment or email.

Happy Learning

Cheers, Team MNCcertified

You may also like...

Leave a Reply

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