mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Intervals Of Time By Week as a postgres til.
This commit is contained in:
@@ -61,6 +61,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
- [Extracting Nested JSON Data](postgres/extracting-nested-json-data.md)
|
- [Extracting Nested JSON Data](postgres/extracting-nested-json-data.md)
|
||||||
- [Fizzbuzz With Common Table Expressions](postgres/fizzbuzz-with-common-table-expressions.md)
|
- [Fizzbuzz With Common Table Expressions](postgres/fizzbuzz-with-common-table-expressions.md)
|
||||||
- [Generate Series Of Numbers](postgres/generate-series-of-numbers.md)
|
- [Generate Series Of Numbers](postgres/generate-series-of-numbers.md)
|
||||||
|
- [Intervals Of Time By Week](postgres/intervals-of-time-by-week.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)
|
||||||
- [String Contains Another String](postgres/string-contains-another-string.md)
|
- [String Contains Another String](postgres/string-contains-another-string.md)
|
||||||
|
|||||||
18
postgres/intervals-of-time-by-week.md
Normal file
18
postgres/intervals-of-time-by-week.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Intervals Of Time By Week
|
||||||
|
|
||||||
|
It is pretty common to use hours or days when creating a Postgres
|
||||||
|
interval. However, intervals can also be created in week-sized chunks
|
||||||
|
|
||||||
|
```sql
|
||||||
|
> select '2 weeks'::interval;
|
||||||
|
interval
|
||||||
|
----------
|
||||||
|
14 days
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
> select make_interval(0,0,7,0,0,0,0);
|
||||||
|
make_interval
|
||||||
|
---------------
|
||||||
|
49 days
|
||||||
|
(1 row)
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user