1Z0-909 · Question #59
Examine this SQL statement:
The correct answer is D. db. country-select(['Name','Population']) .where('Name LIKE :param') -bind ('param' , 'United*') -. Option D is correct because it uses a parameterized query (:param placeholder with .bind()), which is the proper and secure pattern for injecting user-supplied values into query conditions - it prevents SQL injection and follows established query builder best practices for…
Question
Examine this SQL statement:
Options
- Adb.country. fields ( [ 'Name ' , 'Population* ] ) .where ( 'Name LIKE "United%',,) -select ()-limit(5)
- Bdb . country, select ( [ ' Name LIKE "united%" ' , ' Population>^0 ' ] ) - limit (5)
- Cdb . country. fields ( [ ' Name ' , 'Population']) . select (' limit=5 ' ) .where('Name LIKE "United%" ' )
- Ddb. country-select(['Name','Population']) .where('Name LIKE :param') -bind ('param' , 'United*') -
- Edb . country. Select ([Name' , 'Population.'] ) -limit (5) .where('Name LIKE "United%"')
How the community answered
(32 responses)- A9% (3)
- B22% (7)
- C3% (1)
- D59% (19)
- E6% (2)
Explanation
Option D is correct because it uses a parameterized query (:param placeholder with .bind()), which is the proper and secure pattern for injecting user-supplied values into query conditions - it prevents SQL injection and follows established query builder best practices for safe, dynamic filtering.
Why the distractors fail:
- A - Uses
.fields()(not a standard method in this API) and has a malformed column name (Population*), making it syntactically invalid. - B - Embeds the
LIKEcondition and a nonsensicalPopulation>^0expression directly inside.select(), conflating column selection with filtering logic. - C - Passes
'limit=5'as a string argument to.select(), which is invalid;limitis a separate chained call, not a string option inside select. - E - Has a trailing period on
'Population.'(invalid field name) and, depending on the framework,.where()chained after.limit()may not be evaluated correctly.
Memory tip: Think "D for Defense" - option D defends against injection by never interpolating values directly into the query string, using :param + .bind() instead. Whenever you see raw string interpolation or malformed method arguments in the other options, that's a red flag they're wrong.
Topics
Community Discussion
No community discussion yet for this question.