Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chocolatey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sql-cli to the [Chocolatey Community Repository](https://community.chocolatey.or
## Layout

- `sql-cli.nuspec.template` — package metadata. `__VERSION__` is replaced at pack time.
`iconUrl` must stay on `cdn.jsdelivr.net`: moderation rejects `raw.githubusercontent.com`.
- `tools/chocolateyInstall.ps1.template` — downloads the Windows binary from the matching
GitHub release and verifies its SHA256. `__VERSION__` and `__CHECKSUM__` are replaced
at pack time.
Expand Down
2 changes: 1 addition & 1 deletion chocolatey/sql-cli.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<docsUrl>https://github.com/TimelordUK/sql-cli/blob/main/README.md</docsUrl>
<bugTrackerUrl>https://github.com/TimelordUK/sql-cli/issues</bugTrackerUrl>
<licenseUrl>https://github.com/TimelordUK/sql-cli/blob/main/LICENSE</licenseUrl>
<iconUrl>https://raw.githubusercontent.com/TimelordUK/sql-cli/v__VERSION__/assets/icon.png</iconUrl>
<iconUrl>https://cdn.jsdelivr.net/gh/TimelordUK/sql-cli@v__VERSION__/assets/icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Vim-like terminal SQL editor and engine for CSV / JSON / JSONL data.</summary>
<description>
Expand Down
33 changes: 33 additions & 0 deletions examples/countries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,39 @@ FROM #countries
WHERE "name.common" = 'Russia';
go

-- using unnest to explode the borders on left hand side to self join back to get the matching row on right

WITH
all AS (
SELECT
"name.common" as name,
cca3,
latlng,
borders,
area
FROM #countries
),
lc AS (
SELECT
l.name as l_name,
l.cca3 AS iso,
l.latlng,
l.borders,
SPLIT_PART(l.latlng, ',', 1) AS lat,
SPLIT_PART(l.latlng, ',', 2) AS lon,
l.area,
Unnest(l.borders, ',' ) AS border
FROM all
WHERE l.cca3 = 'BRA'
)
SELECT
lc.*,
r.latlng,
r.name as r_name
FROM lc
INNER JOIN all AS r ON l.border = r.cca3
GO

SELECT
"name.common" as name,
region, cca3 as iso,
Expand Down
Loading