📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      What is a 'stored procedure' in

      SQL?
      A A temporary table that stores query results for reuse within a session Correct Answer Incorrect Answer
      B An index structure that stores frequently accessed query results for faster retrieval Correct Answer Incorrect Answer
      C A database trigger that automatically executes when data is modified Correct Answer Incorrect Answer
      D A precompiled, named block of SQL code Correct Answer Incorrect Answer
      E A SQL query saved as a text file that can be scheduled to run automatically Correct Answer Incorrect Answer

      Solution

      A stored procedure is a precompiled named block of SQL code stored in the database. Its advantages are:  • Performance — compiled once, execution plan cached, subsequent calls are faster than parsing the same query repeatedly.  • Reduced network traffic — client sends one CALL statement instead of multiple SQL queries, only results travel back.  • Reusability — multiple applications call the same procedure (CBS, mobile banking, branch terminal all call GetCustomerLoans).  • Security — users granted EXECUTE permission on procedure without direct table access (they can't run arbitrary SELECT on the Loans table).  • Maintainability — change business logic in one place. 

      Practice Next

      Relevant for Exams:

      ask-question