Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get column names with query data in sqlite3?

I use sqlite3 console to debug my app while it is executing in Android. Is there a way to show also column names (not only data) with data in result of sql query?

like image 909
Prizoff Avatar asked Oct 10 '12 10:10

Prizoff


People also ask

How do I find columns in SQLite?

PRAGMA table_info(table_name); will get you a list of all the column names.

How can I get column names from a table in SQL query?

To get the column name of a table we use sp_help with the name of the object or table name. sp_columns returns all the column names of the object. The following query will return the table's column names: sp_columns @table_name = 'News'

Which method is used to get the array of column names of our SQLite table?

getColumnNames() This method returns the array of all the column names of the table.


1 Answers

Yes, after logged into sql prompt mode, execute the following each at a time:

.header on .mode column 
like image 79
waqaslam Avatar answered Sep 23 '22 15:09

waqaslam