Q1
True / FalseQuestion: In MySQL, you can select values from a JSON column using the ->> operator.
The ->> operator in MySQL is used to extract values from JSON columns.
Q2
True / FalseMySQL's JSON functions are available starting from version 5.6.
JSON functions were introduced in MySQL version 5.7.
Q3
True / FalseMySQL's JSON_EXTRACT function can be used to retrieve a specific element from a JSON document.
The JSON_EXTRACT function is used to extract data from a JSON document at a specified path.
Q4
True / FalseIn MySQL, the JSON_UNQUOTE function removes the surrounding quotes from a JSON string.
The JSON_UNQUOTE function removes quotes from a JSON string, converting it to a regular string.
Q5
True / FalseMySQL's JSON_CONTAINS function can check if a JSON document contains a specific key or value.
The JSON_CONTAINS function checks whether a specified value or key exists within a JSON document.
Q6
True / FalseThe JSON_SEARCH function in MySQL returns a boolean value indicating if the search string was found.
The JSON_SEARCH function returns the path to the value if found, not a boolean.
Q7
True / FalseIn MySQL, you can use the JSON_TABLE function to transform a JSON document into a relational table.
The JSON_TABLE function allows you to convert a JSON document into a relational table, making it easier to work with JSON data in SQL queries.
Q8
True / FalseMySQL's JSON_SET function can add or update multiple values in a JSON document at once.
The JSON_SET function can update or add multiple values within a JSON document in one go.
Q9
True / FalseThe JSON_REMOVE function in MySQL can only remove one key-value pair at a time from a JSON document.
The JSON_REMOVE function can remove multiple key-value pairs from a JSON document at once by specifying multiple paths.
Q10
True / FalseIn MySQL, you can use the JSON_ARRAYAGG function to aggregate multiple rows into a JSON array.
The JSON_ARRAYAGG function in MySQL aggregates values from multiple rows into a single JSON array. This is useful for creating JSON representations of result sets.
Q25
Multiple ChoiceWhich SQL query uses JSON_SET to update or insert a key 'city' with value 'New York' in a JSON column 'address'?
SQL Code
UPDATE users
SET address = JSON_SET(address, '$.city', 'New York');
The JSON_SET function inserts or updates the 'city' key with the value 'New York' in the 'address' JSON column for each user.
Q27
Multiple ChoiceIdentify the SQL query that uses JSON_ARRAY to create a JSON array from multiple columns.
SQL Code
SELECT JSON_ARRAY(firstName, lastName, age) AS user_info
FROM users;
The JSON_ARRAY function creates a JSON array from the values of 'firstName', 'lastName', and 'age' columns for each user.
Q30
Multiple ChoiceWhich SQL query uses JSON_SEARCH to find if the key 'status' with value 'active' exists in a JSON column 'attributes'?
SQL Code
SELECT * FROM products
WHERE JSON_SEARCH(attributes, 'one', 'active', NULL, '$.status') IS NOT NULL;
The JSON_SEARCH function searches for the 'status' key with the value 'active' within the 'attributes' JSON column, and the query returns rows where this condition is met.