{"id":16774047,"url":"https://github.com/hgwood/advent-of-code-sql","last_synced_at":"2026-05-19T11:04:45.682Z","repository":{"id":146459788,"uuid":"578697986","full_name":"hgwood/advent-of-code-sql","owner":"hgwood","description":"My solutions to Advent Of Code, written in SQL. See https://adventofcode.com/.","archived":false,"fork":false,"pushed_at":"2023-12-18T00:07:52.000Z","size":159,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T04:18:40.863Z","etag":null,"topics":["advent-of-code","advent-of-code-2022-sql","advent-of-code-2023-sql","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hgwood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-15T17:07:01.000Z","updated_at":"2023-12-10T23:18:33.000Z","dependencies_parsed_at":"2023-12-06T01:25:35.144Z","dependency_job_id":"545e4b54-a9c7-4b4b-96b7-7a7ef9e59d5a","html_url":"https://github.com/hgwood/advent-of-code-sql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgwood%2Fadvent-of-code-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgwood%2Fadvent-of-code-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgwood%2Fadvent-of-code-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgwood%2Fadvent-of-code-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hgwood","download_url":"https://codeload.github.com/hgwood/advent-of-code-sql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243904485,"owners_count":20366674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","advent-of-code-2022-sql","advent-of-code-2023-sql","postgresql","sql"],"created_at":"2024-10-13T06:47:52.669Z","updated_at":"2026-05-19T11:04:45.630Z","avatar_url":"https://github.com/hgwood.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advent of Code SQL\n\nMy solutions to Advent of Code, written in SQL.\n\n## How to run\n\nRun the database then run the solver for the day and part you want on the input you want.\n\n```\ndocker compose up -d\nsh run.sh 2022/day_1/part_1.psql 2022/day_1/example.txt\n```\n\n## How it works\n\nThe code is meant to be run on Postgres 16+. Solutions are written using only\nSQL (no PLpg/SQL). `run.sh` runs `run.psql` using `psql` (the Postgres client\nCLI). `run.psql` creates a schema named `tmp` then sets the search path to it so\nthat all objects created after that are placed in this schema. Then it runs\n`import.psql` which import the input file into the `input` table. Then it runs\nthe solver (a `.psql` file). Finally, it drops the `tmp` schema, which drops all\nobjects created by the solver.\n\n## Philosophy\n\nI mostly use SQL as a purely functional language here. Once the input is loaded\ninto the `input` table, I try to only use `select` to compute stuff from it,\nalong with `create table as` to store results for further computations. I try\nnot to use stateful tables (2022 day 5 is the only exception).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhgwood%2Fadvent-of-code-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhgwood%2Fadvent-of-code-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhgwood%2Fadvent-of-code-sql/lists"}