Which six Transact-SQL statements should you use?

DRAG DROP
You use Microsoft SQL Server 2012 to develop a database application.
You create two tables by using the following table definitions.

Which six Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

DRAG DROP
You use Microsoft SQL Server 2012 to develop a database application.
You create two tables by using the following table definitions.

Which six Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

Answer:

Explanation:



Leave a Reply 5

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


AlexanderS

AlexanderS

The question is Wrong, it says: “Which six Transact-SQL statements should you use?”
But the 1-2-6-3-5 is the right answer

Kristina

Kristina

CREATE FUNCTION dbo.getsubtree(@empid AS int)
RETURNS @Tree TABLE(
empid int NOT NULL,
empname varchar(25) NOT NULL,
mgrid int NULL,
lvl int NOT null
)
AS BEGIN
WITH Employees_Subtree(empid, empname, mgrid, lvl)
AS
(
SELECT empid, empname, mgrid, 0
FROM Employees WHERE empid=@empid
UNION ALL
SELECT e.empid, e.empname, e.mgrid, es.lvl+1
FROM employees AS e
JOIN Employees_SubTree AS es
ON e.mgrid=es.empid
)
INSERT INTO @Tree
SELECT * form Employees_Subtree;
RETURN
END

Sako_Pako

Sako_Pako

Thanks …