Bird
0
0

Given the prepared statement:

medium📝 query result Q4 of 15
SQL - Security Basics
Given the prepared statement:
PREPARE stmt FROM 'SELECT name FROM users WHERE age > ?';
EXECUTE stmt USING @age;

If @age = 30, what will the query return?
AAll user names regardless of age
BAll user names where age equals 30
CAll user names where age is greater than 30
DAn error because @age is not defined
Step-by-Step Solution
Solution:
  1. Step 1: Understand the prepared statement query

    The query selects names from users where age is greater than a parameter.
  2. Step 2: Substitute the parameter value

    With @age = 30, the query returns users with age > 30.
  3. Final Answer:

    All user names where age is greater than 30 -> Option C
  4. Quick Check:

    Output = A [OK]
Quick Trick: Parameter replaces ? in prepared statements [OK]
Common Mistakes:
  • Confusing > with =
  • Assuming all users returned
  • Forgetting to define parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes