Bird
0
0

Why can't SQL functions perform data modification operations like INSERT or UPDATE?

hard📝 Conceptual Q10 of 15
SQL - Stored Procedures and Functions
Why can't SQL functions perform data modification operations like INSERT or UPDATE?
ABecause functions do not accept parameters
BBecause functions must be deterministic and side-effect free
CBecause functions cannot be called from SQL statements
DBecause functions always return multiple result sets
Step-by-Step Solution
Solution:
  1. Step 1: Understand function behavior

    Functions are designed to be deterministic and without side effects.
  2. Step 2: Explain restriction on data modification

    Modifying data causes side effects, which functions avoid to ensure predictability.
  3. Final Answer:

    Because functions must be deterministic and side-effect free -> Option B
  4. Quick Check:

    Functions avoid side effects for reliability [OK]
Quick Trick: Functions avoid side effects; procedures handle data changes [OK]
Common Mistakes:
  • Thinking functions cannot accept parameters
  • Believing functions return multiple result sets
  • Assuming functions cannot be called in SQL

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes