Which five Transact-SQL statements should you use?

DRAG DROP
You write the following SELECT statement to get the last order date for a particular customer.

You need to create the user-defined function to return the last order date for the specified
customer.
Which five 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 write the following SELECT statement to get the last order date for a particular customer.

You need to create the user-defined function to return the last order date for the specified
customer.
Which five 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: See the explanation

Explanation:
Box 1:

Box 2:

Box 3:

Box 4:

Box 5:

Note:
* First function header
* Then declare that the function returns a datetime
* Thirdly begin the function body.
* Fourthly declare the return variable
* At last include the code that retrieves the required date.



Leave a Reply 1

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


Peter

Peter

1) create function – two same answers
2) returns datetime as
3) begin
4) declare @OrderDate datetime
5) first one with ‘return @OrderDate end’