Skip to content

Instantly share code, notes, and snippets.

@deyvicode
Last active January 5, 2022 03:59
Show Gist options
  • Save deyvicode/36a85531318be2c2f03f4ee764993597 to your computer and use it in GitHub Desktop.
Save deyvicode/36a85531318be2c2f03f4ee764993597 to your computer and use it in GitHub Desktop.
Export JSON file from SQL database
SELECT JSON_ARRAYAGG(JSON_OBJECT(
'name', name,
'address', address
))
FROM mybd.mytable
INTO OUTFILE '\path\users.json';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment