I am looking to retrieve a list of columns in a table. The database is the latest release of SQLite (3.6, I believe). I am looking for code that does this with a SQL query. Extra bonus points for metadata related to the columns (e.g. length, data type, etc…)
Share
What you’re looking for is called the data dictionary. In sqlite a list of all tables can be found by querying sqlite_master table (or view?)
To get column information you can use the
pragma table_info(table_name)statement:For more information on the pragma statements, see the documentation.