You are developing a SQL Server 2012 database for ABC.com. You need to create a computed
column that returns the data by referencing another table using an INNER JOIN.
How would you accomplish this?
A.
You should make use of the FORMAT function.
B.
You should make use of a scalar user-defined function.
C.
You should make use of an inline function.
D.
You should make use of a table-valued user-defined function.
E.
You should make use of a stored procedure.
Explanation:
Why not C?
They said a computed column which means its a single value that is abtained referencing another table using an INNER JOIN .
eg sum(e.finalAmt)as total
shouldn’t we use CROSS APPLY and not INNER JOIN??
Inline User-defined Function Rules
Inline user-defined functions follow these rules:
The RETURNS clause contains only the keyword table. You do not have to define the format of a return variable, because it is set by the format of the result set of the SELECT statement in the RETURN clause.
There is no function_body delimited by BEGIN and END.
The RETURN clause contains a single SELECT statement in parentheses. The result set of the SELECT statement forms the table returned by the function. The SELECT statement used in an inline function is subject to the same restrictions as SELECT statements used in views.
The table-valued function accepts only constants or @local_variable arguments