1Z0-908 · Question #18
Examine this SQL statement: Which set of privileges will allow Tom to execute this SQL statement?
The correct answer is D. GRANT UPDATE ON `world'.`city' TO `tom'@'%'; GRANT SELECT ON `world'.`country' TO. Option D is correct because the underlying SQL statement (likely an UPDATE on world.city with a subquery referencing world.country) requires exactly two privileges: UPDATE on the city table to modify rows, and SELECT on the country table to read data from the subquery. Option B…
Question
Examine this SQL statement:
Which set of privileges will allow Tom to execute this SQL statement?
Options
- AGRANT ALL PRIVILEGES ON
world'.city' TOtom'@'%'; GRANT SELECT (code') ON - BGRANT UPDATE ON
world'.* TOtom'@'%'; - CGRANT UPDATE ON
world'.city' TOtom'@'%'; GRANT SELECT ONworld'.* TO `tom'@'%'; - DGRANT UPDATE ON
world'.city' TOtom'@'%'; GRANT SELECT ONworld'.`country' TO
How the community answered
(38 responses)- A3% (1)
- B5% (2)
- C13% (5)
- D79% (30)
Explanation
Option D is correct because the underlying SQL statement (likely an UPDATE on world.city with a subquery referencing world.country) requires exactly two privileges: UPDATE on the city table to modify rows, and SELECT on the country table to read data from the subquery. Option B fails immediately because it only grants UPDATE on all tables in world but omits SELECT entirely - Tom cannot read from country in the subquery. Option C grants SELECT on world.* (every table in the schema), which is overly permissive and violates the principle of least privilege; MySQL exam questions specifically test whether you grant only what is needed, not more. Option A attempts to use column-level SELECT privilege (only on the code column), which is insufficient if the subquery references additional columns from country, or the grant is simply incomplete as written.
Memory tip: Think "verb + object" - match each operation in the SQL to its exact table. An UPDATE city ... WHERE (SELECT FROM country) needs UPDATE on city + SELECT on country - one grant per table, scoped as narrowly as possible.
Topics
Community Discussion
No community discussion yet for this question.