Objective: Complete two Oracle SQL expressions using the NVL and DECODE functions.
This exercise is worth 15 points:
NVL expression.DECODE expression.Both questions use the PRODUCT table from the PETSTORE course-project schema.
PRODUCT_ID, LAST_UPDATE_DATE, and PET_FLAG from the PRODUCT table.
Complete the missing expression in each query. Submit both expressions and briefly explain how each function determines its return value. SQL keywords and function names are not case-sensitive.
Complete the query with an NVL expression that returns LAST_UPDATE_DATE when it contains a value. When it is null, return the date January 1, 2000, using the ANSI date literal DATE '2000-01-01'.
SELECT product_id,
______________________________ AS effective_update_date
FROM product
WHERE product_id < 10
ORDER BY product_id;
Complete the query with a DECODE expression that returns PET when PET_FLAG contains Y. For every other value, including null, return NOT A PET.
SELECT product_id,
______________________________ AS product_type
FROM product
WHERE product_id < 10
ORDER BY product_id;