我需要一種方法來運行SQL命令,然後將結果導出爲JSON格式的文本文件。將SQL查詢導出爲JSON格式的文本文件
我有此鏈接:
但我不明白他的發言CREATE_COLUMN部分,也不是真正的術語,他用明白它如何與我的數據庫。
任何人都可以請這樣簡化他的例子嗎?
SELECT * FROM thisismy.database;
如果我做了以上的INTO OUTFILE命令,我得到的是這樣的數據:
1 Armand Warren 56045 Taiwan, Province of China 0 0
2 Xenos Salas 71090 Liberia 0 0
3 Virginia Whitaker 62723 Nicaragua 0 0
4 Kato Patrick 97662 Palau 0 0
5 Cameron Ortiz P9C5B6 Eritrea 0 0
但我需要它看起來像這樣:
{ "aaData": [
[ "1", "Armand", "Warren", "56045", "Taiwan, Province of China" ],
[ "2", "Xenos", "Salas", "71090", "Liberia" ],
[ "3", "Virginia", "Whitaker", "62723", "Nicaragua" ],
[ "4", "Kato", "Patrick", "97662", "Palau" ],
[ "5", "Cameron", "Ortiz", "P9C 5B6", "Eritrea" ]
] }
任何建議?
感謝
編輯:我跑MariaDB的,是否可以幫助
看到https://mariadb.com/kb/en/mariadb/connect-json-table-type/ –