This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Using FILTER in a window (OVER) | |
PostgreSQL version: 16.2 | |
Bill Wallis, 2025-05-12 | |
*/ | |
drop table if exists events; | |
create table events ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/your-path-to/.local/bin/uv run --script | |
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "wakepy", | |
# ] | |
# /// | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DuckDB cross-data-source query | |
DuckDB version: v1.1.1 | |
Bill Wallis, 2024-12-15 | |
This is just for illustration: the files are purposefully not included in this Gist | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | col_1 | col_2 | col_3 | |
---|---|---|---|---|
1 | a | b | 0.1 | |
2 | c | d | -11 | |
3 | e | f | 111 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* flatten bus route */ | |
with bus_stops(from_stop, to_stop) as ( | |
select 'BM', 'WQS' from dual | |
union all select 'CR', 'BM' from dual | |
union all select 'CS', 'LL' from dual | |
union all select 'GG', 'CS' from dual | |
union all select 'LL', 'OS' from dual | |
union all select 'OS', 'CR' from dual | |
union all select 'WQS', 'GG' from dual | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Recursive CTEs for data generation | |
DuckDB version: 1.0.0 | |
Bill Wallis, 2024-10-18 | |
*/ | |
select version(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating tables... | |
Timing SQLite queries... | |
Start time: 2024-08-31 09:23:05.697240 | |
---------------------------------------- | |
100%|██████████| 10000/10000 [00:02<00:00, 3370.72it/s] | |
query-1.sql: 0.00008558s (50.1%) | |
query-2.sql: 0.00008527s (49.9%) | |
---------------------------------------- | |
End time: 2024-08-31 09:23:08.676550 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Using ROLLUP for subtotals | |
DuckDB version: 1.0.0 | |
Bill Wallis, 2024-08-04 | |
*/ | |
select version(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The WINDOW clause needs some more love | |
DuckDB version: 1.0.0 | |
Bill Wallis, 2024-08-02 | |
*/ | |
select version(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
SQL Indexes (specifically SQLite) | |
SQLite version: 3.45.1 | |
Bill Wallis, 2024-07-27 | |
https://sqlite.org/queryplanner.html | |
https://use-the-index-luke.com/ | |
*/ |
NewerOlder