sqliteHow do I get the column names of a SQLite database?
To get the column names of a SQLite database, you can use the PRAGMA table_info
statement. This statement returns the column names, data types, and other information about the columns in a given table.
For example, to get the column names of a table called people
:
sqlite> PRAGMA table_info(people);
0|name|text|1||0
1|age|integer|0||0
2|gender|text|0||0
The output of the PRAGMA table_info
statement consists of the following parts:
0
: The column numbername
: The column nametext
: The data type of the column1
: A flag indicating whether the column isNOT NULL
0
: A flag indicating whether the column is aPRIMARY KEY
0
: A flag indicating whether the column has aDEFAULT VALUE
Helpful links
More of Sqlite
- How do I troubleshoot a near syntax error when using SQLite?
- How do I install SQLite?
- How do I use SQLite with Zephyr?
- How do I download and install SQLite zip?
- How can SQLite and ZFS be used together for software development?
- How do I use the SQLite ZIP VFS to compress a database?
- How do I use the SQLite zfill function?
- How can I use SQLite with Zabbix?
- How do I extract the year from a datetime value in SQLite?
- How do I call sqlitepcl.raw.setprovider() when using SQLite?
See more codes...