Problem Statement
What is the most effective defense against SQL injection?
Explanation
Parameters keep code and data separate. The engine treats the parameter as a literal, not executable SQL. Combine with allow-list validation and least-privilege accounts to layer defenses.
Code Solution
SolutionRead Only
SELECT * FROM users WHERE email = $1; -- bind at driver
Practice Sets
This question appears in the following practice sets:
