mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Display Results In Readable Column Format as a SQLite TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1353 TILs and counting..._
|
_1354 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ _1353 TILs and counting..._
|
|||||||
* [Ruby](#ruby)
|
* [Ruby](#ruby)
|
||||||
* [sed](#sed)
|
* [sed](#sed)
|
||||||
* [Shell](#shell)
|
* [Shell](#shell)
|
||||||
|
* [SQLite](#sqlite)
|
||||||
* [Streaming](#streaming)
|
* [Streaming](#streaming)
|
||||||
* [Tailwind CSS](#tailwind-css)
|
* [Tailwind CSS](#tailwind-css)
|
||||||
* [tmux](#tmux)
|
* [tmux](#tmux)
|
||||||
@@ -1181,6 +1182,10 @@ _1353 TILs and counting..._
|
|||||||
- [Check If The First Argument Is Given](shell/check-if-the-first-argument-is-given.md)
|
- [Check If The First Argument Is Given](shell/check-if-the-first-argument-is-given.md)
|
||||||
- [Format And Print The Current Date And Time](shell/format-and-print-the-current-date-and-time.md)
|
- [Format And Print The Current Date And Time](shell/format-and-print-the-current-date-and-time.md)
|
||||||
|
|
||||||
|
### SQLite
|
||||||
|
|
||||||
|
- [Display Results In Readable Column Format](sqlite/display-results-in-readable-column-format.md)
|
||||||
|
|
||||||
### Streaming
|
### Streaming
|
||||||
|
|
||||||
- [Monitor An Audio Input Device In OBS](streaming/monitor-an-audio-input-device-in-obs.md)
|
- [Monitor An Audio Input Device In OBS](streaming/monitor-an-audio-input-device-in-obs.md)
|
||||||
|
|||||||
36
sqlite/display-results-in-readable-column-format.md
Normal file
36
sqlite/display-results-in-readable-column-format.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Display Results In Readable Column Format
|
||||||
|
|
||||||
|
By default the output of a query or pragma command will be pretty squished and
|
||||||
|
unreadable.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
sqlite> PRAGMA table_info(User);
|
||||||
|
0|id|TEXT|1||1
|
||||||
|
1|name|TEXT|0||0
|
||||||
|
2|email|TEXT|0||0
|
||||||
|
3|emailVerified|DATETIME|0||0
|
||||||
|
4|image|TEXT|0||0
|
||||||
|
```
|
||||||
|
|
||||||
|
However, this can be improved by setting the output `mode` to `column`.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
sqlite> .mode column
|
||||||
|
```
|
||||||
|
|
||||||
|
With that set, we can run the same command which will now output nicely
|
||||||
|
formatted columns with headers.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
sqlite> PRAGMA table_info(User);
|
||||||
|
cid name type notnull dflt_value pk
|
||||||
|
--- ------------- -------- ------- ---------- --
|
||||||
|
0 id TEXT 1 1
|
||||||
|
1 name TEXT 0 0
|
||||||
|
2 email TEXT 0 0
|
||||||
|
3 emailVerified DATETIME 0 0
|
||||||
|
4 image TEXT 0 0
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on this and the many other output modes, check out [the
|
||||||
|
docs](https://sqlite.org/cli.html#changing_output_formats).
|
||||||
Reference in New Issue
Block a user