MySQL ã§ãã¼ãã«å®ç¾©ã JSONå½¢å¼ã§åãåºã
諸äºæ ã§ãã¼ãã«åã¨ããã¼ãã«ã®ã«ã©ã ã以ä¸ã®ãã㪠JSON å½¢å¼ã§åºãå¿ è¦ããã£ãã
{ "<ãã¼ãã«å1>": [ "<ã«ã©ã å1>", "<ã«ã©ã å2>", ... ], "<ãã¼ãã«å2>": [ "<ã«ã©ã å1>", "<ã«ã©ã å2>", ... ] }
æå㯠MySQL ã§ãã¼ãã«å®ç¾©ã csv ã«åãåºãã¦ãã¹ãã¬ããã·ã¼ãã«è²¼ãä»ãã¦ãGAS 㧠JSON å½¢å¼ã«å¤æãã⦠ã¿ãããªåããã©ããã¨ããã£ã¦ãããã©ãJSON å¨ãã®é¢æ°ã使ãã°ã©ããã MySQL ä¸çºã§ããããã ã£ãã
SELECT JSON_OBJECTAGG( c1.table_name, ( SELECT JSON_ARRAYAGG(column_name) FROM information_schema.columns as c2 WHERE c2.table_name = c1.table_name ) ) FROM information_schema.columns as c1 WHERE table_schema = '<DBå>' ;
ãããã®é¢æ°ã¯ MySQL 5.7.22 以éãªã使ãã模æ§ã ãã©ãsort ã«ã¯æªå¯¾å¿ã£ã½ãã®ã§ããæãã«ä¸¦ã¹æ¿ããããªãå¥ãªæ¹æ³ãåãå¿ è¦ãããããã
Aggregates a result set as a single JSON array whose elements consist of the rows. The order of elements in this array is undefined.
MySQL :: MySQL 8.0 Reference Manual :: 12.19.1 Aggregate Function Descriptions