mirror of
https://github.com/jbranchaud/til
synced 2026-01-08 01:28:02 +00:00
Add List All Rows In A Table as a postgres til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_331 TILs and counting..._
|
_332 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -168,6 +168,7 @@ _331 TILs and counting..._
|
|||||||
- [Is It Null Or Not Null?](postgres/is-it-null-or-not-null.md)
|
- [Is It Null Or Not Null?](postgres/is-it-null-or-not-null.md)
|
||||||
- [Limit Execution Time Of Statements](postgres/limit-execution-time-of-statements.md)
|
- [Limit Execution Time Of Statements](postgres/limit-execution-time-of-statements.md)
|
||||||
- [List All Columns Of A Specific Type](postgres/list-all-columns-of-a-specific-type.md)
|
- [List All Columns Of A Specific Type](postgres/list-all-columns-of-a-specific-type.md)
|
||||||
|
- [List All Rows In A Table](postgres/list-all-rows-in-a-table.md)
|
||||||
- [List All Versions Of A Function](postgres/list-all-versions-of-a-function.md)
|
- [List All Versions Of A Function](postgres/list-all-versions-of-a-function.md)
|
||||||
- [List Available Schemas](postgres/list-available-schemas.md)
|
- [List Available Schemas](postgres/list-available-schemas.md)
|
||||||
- [List Database Users](postgres/list-database-users.md)
|
- [List Database Users](postgres/list-database-users.md)
|
||||||
|
|||||||
32
postgres/list-all-rows-in-a-table.md
Normal file
32
postgres/list-all-rows-in-a-table.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# List All Rows In A Table
|
||||||
|
|
||||||
|
Perhaps the more common way to list all rows in a table is with the
|
||||||
|
following `select` command:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
select * from bedding_types;
|
||||||
|
```
|
||||||
|
|
||||||
|
There is an alternative approach that also selects all rows from a table.
|
||||||
|
It's essentially a shorthand -- the `table` command.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
table bedding_types;
|
||||||
|
name
|
||||||
|
----------
|
||||||
|
No Bed
|
||||||
|
1 Full
|
||||||
|
1 Double
|
||||||
|
2 Double
|
||||||
|
1 Twin
|
||||||
|
2 Twins
|
||||||
|
1 Queen
|
||||||
|
2 Queen
|
||||||
|
1 King
|
||||||
|
2 Kings
|
||||||
|
3 Kings
|
||||||
|
Murphy
|
||||||
|
Sofa Bed
|
||||||
|
```
|
||||||
|
|
||||||
|
h/t Jack Christensen
|
||||||
Reference in New Issue
Block a user