0
0
MySQLquery~5 mins

JSON data type in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the JSON data type in MySQL?
The JSON data type stores JSON (JavaScript Object Notation) documents in a column. It allows you to store structured data like objects and arrays directly in the database.
Click to reveal answer
beginner
How do you insert JSON data into a MySQL JSON column?
You insert JSON data as a string using single quotes, for example: INSERT INTO table (json_column) VALUES ('{"key": "value"}');
Click to reveal answer
intermediate
What is one advantage of using the JSON data type over a plain text column?
MySQL validates the JSON format when inserting data and provides functions to query and manipulate JSON data efficiently.
Click to reveal answer
intermediate
Name a MySQL function used to extract data from a JSON column.
JSON_EXTRACT(json_column, '$.key') extracts the value associated with 'key' from the JSON document stored in json_column.
Click to reveal answer
advanced
Can you index a JSON column in MySQL?
Yes, you can create generated columns based on JSON values and index those columns for faster queries.
Click to reveal answer
Which MySQL data type is designed to store JSON documents?
AVARCHAR
BTEXT
CJSON
DBLOB
How do you query a value from a JSON column in MySQL?
AUsing CONCAT() function
BUsing SUBSTRING() function
CUsing CAST() function
DUsing JSON_EXTRACT() function
What happens if you try to insert invalid JSON into a JSON column?
AMySQL rejects the insert with an error
BMySQL stores it as plain text
CMySQL converts it to valid JSON automatically
DMySQL truncates the data
Which of these is a valid JSON document to insert into a JSON column?
A{"name": "Alice", "age": 30}
B{name: Alice, age: 30}
C[name: "Alice", age: 30]
Dname: Alice, age: 30
How can you improve query performance on JSON data in MySQL?
AStore JSON as plain text
BCreate generated columns from JSON values and index them
CUse only SELECT * queries
DAvoid indexing
Explain what the JSON data type is in MySQL and why it is useful.
Think about how JSON data is different from plain text.
You got /4 concepts.
    Describe how you can query and index JSON data in MySQL.
    Focus on functions and indexing strategies.
    You got /3 concepts.