Created
April 4, 2019 21:42
-
-
Save lewdev/6312476ff9461e58f7416a391dee2ccb to your computer and use it in GitHub Desktop.
SQLite query to get column data by rows with additional information about each column.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
m.name AS table_name, | |
p.cid AS col_id, | |
p.name AS col_name, | |
p.type AS col_type, | |
p.pk AS col_is_pk, | |
p.dflt_value AS col_default_val, | |
p.[notnull] AS col_is_not_null | |
FROM sqlite_master m | |
LEFT OUTER JOIN pragma_table_info((m.name)) p | |
ON m.name <> p.name | |
WHERE m.type = 'table' | |
AND m.name LIKE '%QUERY TABLE NAME HERE%' | |
ORDER BY table_name, col_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment