Format SQLite Query Results as Columns with Column Headers

By default, when you connect to the SQLite command line shell and run a query, the result is returned as a pipe separated list.

You might have noticed that the results don’t include the column names, which can make your results confusing if you’re trying to read them, especially if the query returned many columns.

Fortunately, there’s an easy way to format the output so that it’s displayed as a column with column headers.

Continue reading

Create a Temporary Table in SQLite

When you create a table in SQLite, you can create it as a permanent table or as a temporary table.

When you create a table in a database that you’ve created, that would be a permanent table. A temporary table is created in the temp database.

To create a temporary table, you use the same syntax as creating a regular table. The difference is that you use either the TEMP or TEMPORARY keyword. You can also (or alternatively) prefix the table name with temp, which indicates that it will be created in the temporary database.

Continue reading