Hybrid data modeling – using both structured and semi-structured data – can meet the flexibility requirements of modern web, mobile and IoT applications, without sacrificing ACID transactions or standard SQL.
Learn how to model structured and semi-structured data, index and query JSON documents with SQL and enforce the data integrity of JSON documents.Watch now
You can use transactions to insert/modify multiple JSON documents.
You can apply integrity constraints to specific fields within JSON documents.
You can query JSON documents using standard SQL functions and JOIN JSON data with existing tables.
You can index specific fields within JSON documents.
You can return JSON documents as relational data, and vice versa.
What if you want to store user profiles in a single row? Yes, a user has user_id, name and country (and more). However, users may have personal and work email addresses as well as mobile and office phone numbers. While some users have Twitter and LinkedIn accounts, others may have Facebook and Instagram accounts. What about interests?
With JSON functions, you can store users profiles in a single row.
"mobile": "(555) 555-5555"},
SELECT name, JSON_VALUE(attr, "$.email.personal") AS email, JSON_VALUE(attr, "$.social.twitter") AS twitter, JSON_VALUE(attr, "$.interests") AS favorite_interest FROM tbl_user_profiles WHERE user_id = "sjohnson";
MariaDB includes a comprehensive set of SQL functions for creating and querying JSON documents – everything from reading and writing fields, arrays and objects to creating JSON documents and merging relational data.Read more