MySQL Database Management

Master MySQL database design, queries, joins, and optimization techniques.

intermediate Databases 5 hours

Chapter 14: Working with JSON and NoSQL Features

Chapter 14 of 15

Chapter 14: Working with JSON and NoSQL Features

14.1 JSON Data Type

MySQL 5.7+ supports native JSON data type.

-- Create table with JSON column
CREATE TABLE products (
    id INT PRIMARY KEY,
    name VARCHAR(100),
    attributes JSON
);

-- Insert JSON data
INSERT INTO products VALUES 
(1, 'Product 1', '{"color": "red", "size": "large"}');

-- Query JSON data
SELECT name, attributes->>"$.color" as color 
FROM products;