MySQL 8.0: From SQL Tables to JSON Documents
MySQL 8.0: From SQL Tables to JSON Documents
One of the nice things about MySQL 8.0 is the ability to combine the relational and document models. As a developer, you can choose to work with traditional SQL tables, with schemaless JSON documents, or with both types at the same time. Here we show how to bridge SQL tables and JSON documents by using JSON functions. Enjoy!
Step.1.Create sample database.
step.2.create table insert record.
Here we use two JSON aggregation functions called JSON_ARRAYAGG() and JSON_OBJECT(). We simply select from employees and convert the result set into JSON like this:
Comments
Post a Comment