Skip to content

Commit

Permalink
More functions this works with
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw authored Dec 18, 2020
1 parent c774d0b commit f3ef4ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sqlite/list-all-columns-in-a-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ from
sqlite_master
join pragma_table_info(sqlite_master.name) as table_info
order by
sqlite_master.name,
table_info.cid
sqlite_master.name
```
[Demo](https://latest.datasette.io/fixtures?sql=select%0D%0A++sqlite_master.name+as+table_name%2C%0D%0A++table_info.*%0D%0Afrom%0D%0A++sqlite_master%0D%0A++join+pragma_table_info%28sqlite_master.name%29+as+table_info%0D%0Aorder+by%0D%0A++sqlite_master.name%2C%0D%0A++table_info.cid).

This works with the `pragma_table_info` and `pragma_index_list` and `pragma_foreign_key_list` functions too.

## Another recipe

[Amjith pointed](https://twitter.com/amjithr/status/1258576704164909056) to [this query](https://github.com/dbcli/litecli/blob/829220b1e2c3fea84d7c3f0ea8f791f3c28e6230/litecli/sqlexecute.py#L33-L39) used in litecli:
Expand Down

1 comment on commit f3ef4ad

@simonw
Copy link
Owner Author

@simonw simonw commented on f3ef4ad Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.