MySQL 8.0: From JSON Documents Tables to SQL
MySQL 8.0: From JSON Documents Tables to SQL
Here we use the JSON table function called JSON_TABLE(). This function creates an SQL view on the JSON Document, i.e. a mapping between JSON and SQL. We then wrap a CREATE TABLE employees AS around it like this:
CREATE TABLE employees2 AS SELECT * FROM JSON_TABLE(@jsonempl, "$[*]" COLUMNS (id INT PATH "$.id", name VARCHAR(45) PATH "$.name", age INT PATH "$.age")) emps;
Comments
Post a Comment