
Answer-first summary for fast verification
Answer: GREATEST
The GREATEST function will return the highest value from a list of arguments. Using GREATEST(AgentPrice, WholesalePrice, ListPrice) will ensure that the highest price among the three columns is selected. The COALESCE function is used to return the first non-NULL value in a list, but it doesn't fit this requirement. MAX function cannot be used for comparing multiple columns in this context; it's typically used for a single column within a group.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You manage a Fabric warehouse with a table named Sales.Products. This table includes the columns: AgentPrice, WholesalePrice, and ListPrice. Your task is to write a T-SQL query that returns the maximum price from these columns for each product. How will you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct answer is worth one point.
A
GREATEST
B
COALESCE
C
MAX
D
List price
No comments yet.