1. Evaluate this SQL statement :
SELECT c.customer_id, o.order_id, o.order_date, p.product_name
FROM customer c, curr_order o, product p
WHERE customer.customer_id = curr_order. customer_id
AND o.product_id = p.product_id
ORDER BY o.order_amount;
This statement fails when executed. Which change will correct the problem?
- Use the table name in the ORDER BY clause.
- Remove the table aliases from the WHERE clause.
- Include the ORDER_AMOUNT column in the SELECT list.
- Use the table aliases instead of the table names in the WHERE clause.
- Remove the table alias from the ORDER BY clauses and use only the column name.
Jawaban : D
Ketika melakukan join beberapa table yang banyak, sehingga memudahkan dan tidak ambigu. Karena alias pada WHERE salah, seharusnya WHERE c.customer_id = o.customer_id