48

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?

3 Answers 3

92

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

.header on
.mode column
Sign up to request clarification or add additional context in comments.

2 Comments

further, if you run .help it will give you all the options available to run on sql-prompt
If your query results are too wide to fit on one line, then setting .mode line can be useful: it prints the fields one per line, in the format <field name> = <field value>.
3
cat > ~/.sqliterc << EOF
.headers on
.mode table
EOF

Comments

1
.headers on
.mode table
SELECT * FROM patients;
+--------------+-----------------+
| patient_name | patient_profile |
+--------------+-----------------+
| Name1        | 11              |
| Name2        | 11              |
| Name3        | 11              |
+--------------+-----------------+

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.