Complete the code to return the value of 'score' or 0 if it is NULL.
SELECT IFNULL(score, [1]) AS result FROM games;The IFNULL function returns the first argument if it is not NULL; otherwise, it returns the second argument. Here, if 'score' is NULL, it returns 0.
Complete the code to return the first non-NULL value among 'nickname', 'username', or 'guest'.
SELECT COALESCE(nickname, username, [1]) AS display_name FROM users;COALESCE returns the first non-NULL value from the list. If both 'nickname' and 'username' are NULL, it returns 'guest'.
Complete the code to return the value of 'price' or 100 if it is NULL.
SELECT IFNULL(price, [1]) AS final_price FROM products;The IFNULL function returns the first argument if it is not NULL; otherwise, it returns the second argument. Here, if 'price' is NULL, it returns 100.
Fill both blanks to create a dictionary of words and their lengths only if length is greater than 3.
SELECT word, LENGTH(word) AS length FROM words WHERE LENGTH(word) [1] [2];
The query selects words where the length is greater than 3. So the operator is '>' and the number is 3.
Fill all three blanks to select the first non-NULL email from 'email1', 'email2', or 'email3'.
SELECT COALESCE([1], [2], [3]) AS contact_email FROM contacts;
COALESCE returns the first non-NULL value among the given columns. Here, it checks 'email1', then 'email2', then 'email3'.