QuestionQ33

VerifiedRetrieving Data Using the SQL SELECT Statement

Refer to the Exhibit and review the structure of the products table.

Question Image

Every product has a list price. You issue the following command to display each product’s total price after applying a 25% discount and a 15% tax. Freight charges of $100 must be applied to all products.

Question Image

What is the outcome if all parentheses are removed from the preceding statement?

Explanation

Oracle SQL evaluates multiplication and division before addition and subtraction. Without parentheses, the tax multiplication applies only to the final discounted-price term rather than to the entire discounted price. The resulting expression is 1.7125 × list price + 100, instead of the intended 0.8625 × list price + 100, so the total price is higher. Oracle documents that parentheses can override operator precedence and that * and / have higher precedence than binary + and -.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!