MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:JSON SELECT
Current Quiz Count:30
Progress
0%
Q1
True / False

Question: In MySQL, you can select values from a JSON column using the ->> operator.

Q2
True / False

MySQL's JSON functions are available starting from version 5.6.

Q3
True / False

MySQL's JSON_EXTRACT function can be used to retrieve a specific element from a JSON document.

Q4
True / False

In MySQL, the JSON_UNQUOTE function removes the surrounding quotes from a JSON string.

Q5
True / False

MySQL's JSON_CONTAINS function can check if a JSON document contains a specific key or value.

Q6
True / False

The JSON_SEARCH function in MySQL returns a boolean value indicating if the search string was found.

Q7
True / False

In MySQL, you can use the JSON_TABLE function to transform a JSON document into a relational table.

Q8
True / False

MySQL's JSON_SET function can add or update multiple values in a JSON document at once.

Q9
True / False

The JSON_REMOVE function in MySQL can only remove one key-value pair at a time from a JSON document.

Q10
True / False

In MySQL, you can use the JSON_ARRAYAGG function to aggregate multiple rows into a JSON array.

Q11
Single Choice

What function in MySQL is used to extract a value from a JSON document?

Q12
Single Choice

Given a JSON column named data with a JSON object {"name": "John", "age": 30}, how would you select the value of the "name" key?

Q13
Single Choice

Which function can be used to check if a JSON document contains a specific key in MySQL?

Q14
Single Choice

How do you extract a JSON array element from a JSON column in MySQL?

Q15
Single Choice

What is the output of the following query?

SQL Code
SELECT JSON_UNQUOTE(JSON_EXTRACT('{"name": "Alice"}', '$.name'));
Q16
Single Choice

To find rows where a JSON column data contains a specific value, which function would you use?

Q17
Single Choice

How would you update a JSON document in a column named data to change the value of the key "status" to "active"?

SQL Code
UPDATE table_name
SET data = JSON_SET(data, '$.status', 'active');
Q18
Single Choice

Which MySQL function is used to add a new key-value pair to a JSON object in a column named data?

Q19
Single Choice

What is the result of this query?

SQL Code
SELECT JSON_EXTRACT('{"person": {"name": "John", "age": 30}}', '$.person.age');
Q20
Single Choice

Which function would you use to check if a JSON column data contains an object with a specific key-value pair in MySQL?

SQL Code
SELECT JSON_CONTAINS(data, '{"key": "value"}', '$');
What is this query checking for?
Q21
Multiple Choice

Which SQL query extracts the value of 'firstName' from a JSON column 'profile' using JSON_EXTRACT?

SQL Code
SELECT JSON_EXTRACT(profile, '$.firstName') AS first_name
FROM users;
Q22
Multiple Choice

Identify the SQL query that retrieves all users where the 'age' key in the 'profile' JSON column is greater than 25.

SQL Code
SELECT * FROM users
WHERE JSON_EXTRACT(profile, '$.age') > 25;
Q23
Multiple Choice

Which SQL query uses JSON_UNQUOTE to extract and unquote the value of 'lastName' from a JSON column 'profile'?

SQL Code
SELECT JSON_UNQUOTE(JSON_EXTRACT(profile, '$.lastName')) AS last_name
FROM users;
Q24
Multiple Choice

Determine the SQL query that checks if the 'profile' JSON column contains a key 'email'.

SQL Code
SELECT * FROM users
WHERE JSON_CONTAINS_PATH(profile, 'one', '$.email');
Q25
Multiple Choice

Which 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');
Q26
Multiple Choice

Which SQL query uses JSON_REMOVE to delete the key 'phone' from a JSON column 'contact_info'?

SQL Code
UPDATE users
SET contact_info = JSON_REMOVE(contact_info, '$.phone');
Q27
Multiple Choice

Identify 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;
Q28
Multiple Choice

Which SQL query uses JSON_UNQUOTE to return an unquoted string from a JSON column 'metadata'?

SQL Code
SELECT JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.title')) AS title
FROM articles;
Q29
Multiple Choice

Determine the SQL query that uses JSON_MERGE_PATCH to merge two JSON columns 'preferences' and 'defaults'.

SQL Code
SELECT JSON_MERGE_PATCH(preferences, defaults) AS final_preferences
FROM user_settings;
Q30
Multiple Choice

Which 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;