Bird
0
0

Consider this SQL code:

medium📝 query result Q4 of 15
SQL - Stored Procedures and Functions
Consider this SQL code:
CREATE FUNCTION addTax(amount DECIMAL) RETURNS DECIMAL AS $$ BEGIN RETURN amount * 1.1; END; $$ LANGUAGE plpgsql;
SELECT addTax(100);

What will be the output of the SELECT statement?
A110.0
B100
C1.1
DError: function not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function logic

    The function multiplies the input amount by 1.1 to add 10% tax.
  2. Step 2: Calculate the output for input 100

    100 * 1.1 = 110.0, so the function returns 110.0.
  3. Final Answer:

    The output will be 110.0 -> Option A
  4. Quick Check:

    Function output = 110.0 [OK]
Quick Trick: Function returns calculated value directly [OK]
Common Mistakes:
  • Assuming function returns input unchanged
  • Expecting error due to syntax
  • Confusing function with procedure call

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes