Exam Preparation Quiz

Question 50 of 75

Choose the correct T-SQL function

You are working as a data analyst for MDFT Pro, a well-known training agency. The academy uses a Fabric warehouse to track their training course sales. The warehouse contains a table named Courses that stores information about their training courses. The table contains the following columns.

NameDatatypeNullable
CourselDIntegerNo
CourseNameDecimal(18, 2)No
ListPriceDecimal(18, 2)No
WholesalePriceDecimal(18, 2)Yes
AgentPriceDecimal(18, 2)Yes

Your manager has asked you to write a T-SQL query that will return the following columns to help analyze course pricing.

NameDescription
CourseIDReturn the CourseID value
HighestPriceReturns the highest value from ListPrice, WholesalePrice and AgentPrice
TradePriceReturns AgentPrice if present, otherwise returns WholesalePrice if present, otherwise returns ListPrice

You have the following T-SQL query:

SELECT 
    CourseID, 
    ________________ (ListPrice, WholesalePrice, AgentPrice) AS HighestPrice
FROM Courses

How should you complete the query?

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about T-SQL logical functions:
T-SQL Logical Functions
Next Question