Complete the code to use the IF function to check if the score is greater than 50.
SELECT IF(score [1] 50, 'Pass', 'Fail') AS result FROM exams;
The IF function checks if the score is greater than 50. If true, it returns 'Pass', otherwise 'Fail'.
Complete the code to return 'Adult' if age is 18 or more, else 'Minor'.
SELECT IF(age [1] 18, 'Adult', 'Minor') AS status FROM people;
The IF function checks if age is 18 or more using '>='. If true, it returns 'Adult', else 'Minor'.
Fix the error in the IF function to correctly check if salary is not equal to 0.
SELECT IF(salary [1] 0, 'Has Salary', 'No Salary') FROM employees;
The '!=' operator checks if salary is not equal to 0. This fixes the error in the condition.
Fill both blanks to return 'High' if price is greater than 100, else 'Low'.
SELECT IF(price [1] 100, '[2]', 'Low') AS price_level FROM products;
The IF function checks if price is greater than 100 using '>'. If true, it returns 'High', else 'Low'.
Fill both blanks to return the uppercase name if active is 1 and age is over 30, else return 'Inactive'.
SELECT IF(active = 1 AND age [1] 30, UPPER(name), '[2]') AS status_name FROM users;
The IF function checks if active is 1 and age is greater than 30 using '>'. The UPPER function needs an opening parenthesis '(' before the column name and a closing parenthesis ')' after it. If the condition is false, it returns 'Inactive'.