1Z0-909 Sample Questions & Answers
Ranges across transaction control and isolation levels, prepared statements and SQL modes, designing views and working with data types, choosing MySQL connectors, optimizing queries, stored routines and triggers, and JSON document handling.
Launch the full 1Z0-909 simulator →Showing 10 of 20 free samples.
- Question 1Intermediate
JSON and Document Store · Process data in JSON documents
True or False: In MySQL 8.0, using the
JSON_TABLE()function, you can project a JSON document into a relational table format within a single query, which can then be joined with other standard relational tables.Show answer & explanation
Correct answer: A
This statement is true. The
JSON_TABLE()function is a powerful feature in MySQL 8.0 that allows you to extract data from a JSON document and present it as a relational table with specified columns and data types. This resulting virtual table can be used in theFROMclause of a query and joined with other physical or virtual tables. - Question 2Advanced
JSON and Document Store · Explain application development with NoSQL and XDevAPI
An e-commerce company, "GlobalCart," is migrating its product catalog to a MySQL 8.0 database. The catalog data for each product is semi-structured and received from various suppliers as JSON documents. A key requirement is to allow flexible schema changes without database migrations, while also supporting high-performance filtering on specific attributes like
priceandbrand_idwhich are nested deep within the JSON. The development team is also building a new set of microservices that will interact with this data using modern, fluent APIs rather than raw SQL strings.The current table is defined as
CREATE TABLE products (id INT PRIMARY KEY, doc JSON);. Initial performance tests show that queries filtering on price, such asSELECT * FROM products WHERE JSON_EXTRACT(doc, '$.details.price') < 50;, are very slow because they require a full table scan and JSON parsing for every row.Which solution best meets GlobalCart's requirements for schema flexibility, query performance, and modern API access?
Show answer & explanation
Correct answer: C
This is the optimal solution. Using the MySQL Document Store and XDevAPI directly addresses all requirements. It maintains schema flexibility (NoSQL model), provides high-performance filtering by allowing indexes on nested JSON fields, and offers a modern, fluent API (XDevAPI) for microservice development. While adding generated columns (Option B) solves the performance issue, it doesn't address the need for a modern API and ties the schema more tightly to relational concepts. The other options are significantly less performant and scalable.
- Question 3Beginner
Connectors and APIs · Choose between connectors for a given application
A developer needs to connect a new Python application to a MySQL 8.0 database. The requirements are to use an official, pure Python driver that supports the new X Protocol for Document Store access. Which connector should be chosen?
Show answer & explanation
Correct answer: A
MySQL Connector/Python is the official Oracle driver for Python. It is a pure Python implementation and provides support for both the classic MySQL protocol and the new X Protocol, which is required for interacting with the MySQL Document Store via the XDevAPI.
- Question 4Intermediate
MySQL Schema Objects and Data · Design, create, and alter views
You need to design a view that summarizes customer order totals. The view should prevent any direct
INSERTorUPDATEoperations that would result in a customer having a negative total order value. How can this constraint be enforced through the view definition?Show answer & explanation
Correct answer: B
The
WITH CHECK OPTIONclause is used to enforce the conditions in the view'sWHEREclause for anyINSERTorUPDATEstatements performed through the view. If the view is defined withWHERE total_order_value >= 0, addingWITH CHECK OPTIONwill cause any modification that violates this condition to fail. However, a view with aggregation (SUM) is not updatable, so this option would only work on an updatable view. In a non-updatable view scenario, a trigger would be the only way. - Question 5IntermediateSelect 2
Transactions · Control transactions in SQL
A batch import process is inserting millions of rows into an InnoDB table within a single transaction. The process is consuming excessive memory and UNDO log space, occasionally causing the server to run out of resources. Which TWO actions can mitigate this issue without sacrificing the all-or-nothing nature of the import? (Select TWO)
Show answer & explanation
Correct answers: A, B
Processing the import in smaller batches reduces the size of each individual transaction. This prevents the UNDO log from growing excessively and reduces memory consumption per transaction.
Committing after each smaller batch finalizes that part of the work, allowing MySQL to reclaim the UNDO log space and other resources used by that transaction. This combination of batching and committing is a standard pattern for large data loads.
- Question 6Beginner
Data-driven Applications · Use prepared statements
A developer is writing a prepared statement in a Java application to prevent SQL injection. The query needs to fetch a user by their integer ID. What is the correct placeholder to use in the SQL string for the prepared statement?
Show answer & explanation
Correct answer: C
The question mark (
?) is the standard positional placeholder used in prepared statements with MySQL connectors like Connector/J for Java. The values are then bound to these placeholders in the order they appear. - Question 7Intermediate
MySQL Schema Objects and Data · Store and process spatial data
A table stores geographic locations of retail stores using a
POINTdata type. A query is needed to find all stores within a 10-kilometer radius of a given coordinate. Which function is best suited for this calculation?Show answer & explanation
Correct answer: B
ST_Distance_Sphere()is the appropriate function for calculating the distance between two points on a spherical model of the Earth, which is ideal for geographic coordinates. It returns the distance in meters, so the result can be compared to 10,000 (10km) to find all stores within the radius.ST_Distancecalculates Cartesian distance, which is incorrect for lat/lon.ST_ContainsandST_Withinare for checking if one geometry is inside another, not for radius searches. - Question 8Intermediate
MySQL Stored Programs · Create and execute triggers
You need to create a trigger that prevents a product's price from being updated to a value less than its cost. The
productstable haspriceandcostcolumns. Which combination of trigger time and event is correct for this requirement?Show answer & explanation
Correct answer: B
A
BEFORE UPDATEtrigger is the correct choice. It fires before the data modification occurs, allowing you to inspect the incoming new value (NEW.price) and compare it to the cost (NEW.cost). If the condition is not met, you can useSIGNALto raise an error and prevent the update from happening. AnAFTER UPDATEtrigger would be too late, as the invalid data would have already been written. - Question 9Beginner
Data-driven Applications · Set SQL Modes to change MySQL behavior
A query returns an unexpected result set, and you suspect it's due to the current session's SQL mode. Which command would you use to view the SQL mode settings for only your current connection?
Show answer & explanation
Correct answer: C
To view a system variable for the current session, you can use
SELECT @@SESSION.variable_name;or the aliasSELECT @@variable_name;. UsingSHOW SESSION VARIABLES LIKE 'sql_mode';would also work. TheGLOBALkeyword is used to view or set the global value that applies to new connections, not the current one. - Question 10Intermediate
JSON and Document Store · Use MySQL Shell to access document stores
When using the MySQL Shell in JavaScript mode to interact with a Document Store, which object is the entry point for performing collection-level operations like
find(),add(), orcreateIndex()?Show answer & explanation
Correct answer: B
In MySQL Shell's JavaScript and Python modes, the global
dbobject represents the current schema (database). You access collections through this object, for example:db.myCollection.find('name = "test"'). Thesessionobject represents the connection itself, andshellprovides access to shell-specific APIs.
Ready for the real thing?
The full 1Z0-909 simulator has every exam-style question, timed mode, and instant scoring.