DeveloperBreeze

Tutorials Programming Tutorials, Guides & Best Practices

Explore 148+ expertly crafted tutorials tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

JSON Operations in MySQL: Examples and Use Cases

Cheatsheet August 21, 2024
json

This query extracts the theme key, removes the quotes, and ensures the key exists.

These examples illustrate the powerful capabilities of MySQL's JSON functions, enabling you to store, query, and manipulate JSON data directly in the database. Whether you're handling complex data structures or just need flexible data storage, MySQL's JSON support can be a valuable tool in your database management toolkit.

Selecting the Sum of a JSON Property in MySQL

Tutorial August 17, 2024
json mysql

Now, let's insert some sample data into the orders table. Each row will contain an order with a JSON field for order_details, which includes properties like quantity, price, and product.

INSERT INTO orders (customer_name, order_details) VALUES
('Alice', '{"quantity": 3, "price": 19.99, "product": "T-shirt"}'),
('Bob', '{"quantity": 1, "price": 9.99, "product": "Cap"}'),
('Charlie', '{"quantity": 2, "price": 15.49, "product": "Mug"}');