Complete the code to find the greatest value among three numbers.
SELECT GREATEST([1]) AS max_value;The GREATEST function takes multiple arguments separated by commas and returns the largest value. So, 5, 10, 3 is the correct way to pass the numbers.
Complete the code to find the least value among columns price1, price2, and price3 in the products table.
SELECT LEAST([1]) AS min_price FROM products;The LEAST function compares multiple columns or values separated by commas and returns the smallest one. So, the columns must be separated by commas without quotes.
Fix the error in the code to correctly find the greatest value between two columns colA and colB.
SELECT GREATEST([1]) AS max_val FROM data;The GREATEST function requires its arguments to be separated by commas without quotes or parentheses around them as a single argument. So, colA, colB is correct.
Fill both blanks to find the least value between two columns and rename the output as lowest.
SELECT LEAST([1]) AS [2] FROM sales;
The LEAST function needs the columns separated by commas, and the alias for the output can be any valid name like lowest.
Fill all three blanks to select the greatest value between col1 and col2, rename it as max_col, and filter rows where the greatest value is greater than 100.
SELECT GREATEST([1]) AS [2] FROM records WHERE GREATEST([3]) > 100;
The GREATEST function requires columns separated by commas. The alias max_col names the output. The WHERE clause uses the same columns separated by commas to filter rows.