Bird
0
0

Which of the following is a correct syntax example for parameter binding in a SQL query using named parameters?

easy📝 Syntax Q3 of 15
SQL - Security Basics
Which of the following is a correct syntax example for parameter binding in a SQL query using named parameters?
ASELECT * FROM users WHERE id = #userId
BSELECT * FROM users WHERE id = :userId
CSELECT * FROM users WHERE id = $userId?
DSELECT * FROM users WHERE id = ?userId
Step-by-Step Solution
Solution:
  1. Step 1: Identify named parameter syntax

    Named parameters use a colon followed by the parameter name, like :userId.
  2. Step 2: Check each option

    SELECT * FROM users WHERE id = :userId uses :userId correctly; others use invalid symbols or syntax.
  3. Final Answer:

    SELECT * FROM users WHERE id = :userId -> Option B
  4. Quick Check:

    Named parameter syntax = colon + name [OK]
Quick Trick: Named parameters start with a colon ':' [OK]
Common Mistakes:
  • Using question marks with names
  • Using dollar signs or hashes incorrectly
  • Confusing positional and named parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes