Skip to content

Instantly share code, notes, and snippets.

@luobotang
Last active January 28, 2019 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luobotang/928a2700b76fd99f40ab7a706dadd455 to your computer and use it in GitHub Desktop.
Save luobotang/928a2700b76fd99f40ab7a706dadd455 to your computer and use it in GitHub Desktop.
function generateSql(db) {
return `
SELECT
t.table_name,
c.column_name,
c.data_type
FROM
INFORMATION_SCHEMA.TABLES t JOIN
INFORMATION_SCHEMA.COLUMNS c ON
t.table_schema = c.table_schema AND
t.table_name = c.table_name
WHERE
t.table_schema = '${db}'
ORDER BY
t.table_schema,
t.table_name,
c.ordinal_position`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment