Database Management
Accenture PrimermediumDatabase Management06 Function-Scalar & Aggregate

We need to create a report to display the order id, ship date and order total of your ORDER table. If the order has not been shipped, your report must display 'Not Shipped'. If the total is not available, your report must display 'Not Available'. In the ORDER table, the SHIPDATE column has a datatype of DATE. The TOTAL column has a datatype of INT. Which statement do you use to create this report?

Answer options

A
SELECT ordid, IFNULL(shipdate, 'Not Shipped') SHIPDATE, IFNULL(total,'Not Available') TOTAL FROM order;
B
SELECT ordid, IFNULL(shipdate, 'Not Shipped') as SHIPDATE, Total FROM order;
C
SELECT ordid, TO_CHAR(shipdate, 'Not Shipped'), TO_CHAR(total,'Not Available') FROM order;
D
SELECT ordid, shipdate 'Not Shipped', total 'Not Available' FROM order;

Correct answer: SELECT ordid, IFNULL(shipdate, 'Not Shipped') SHIPDATE, IFNULL(total,'Not Available') TOTAL FROM order;

Explanation

IFNULL(expr, replacement) returns the replacement when expr is NULL. Both columns need IFNULL applied.

Related Accenture Database Management questions

Practice more Accenture Database Management questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.