1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Intervals Of Time By Week as a postgres til.

This commit is contained in:
jbranchaud
2015-07-02 08:45:41 -05:00
parent b54a6bd807
commit 287316b506
2 changed files with 19 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Extracting Nested JSON Data](postgres/extracting-nested-json-data.md)
- [Fizzbuzz With Common Table Expressions](postgres/fizzbuzz-with-common-table-expressions.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)
- [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)

View 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)
```