Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

SQLite: Get the information of all tables as HTML

You can get the information of all tables as HTML with headers with a one-liner like this:

for i in `sqlite3 AdventureWorks.db ".tables"`; do echo "<h3>$i</h3><table>"; sqlite3 -html -header AdventureWorks.db "PRAGMA table_info('$i');"; echo "</table>"; done

Note that you can't use .schema in the same manner because .schema get the DDL of all tables in the database automatically.