AdventOfSQL.com solutions

Hi folks,

I saw adventofsql.com pop up in r/Elixir a few weeks ago and signed-up, then promptly forgot all about it …until I opened my email this morning!

The day 1 puzzle was fun - not too hard, and I spent more time transforming the data than anything. You can see my working solution here (spoiler!) - and in a gist for posterity (again, spoiler!).

Full disclosure: I used ChatGPT quite a bit to guide me, and especially to write the Python script which converts the JSON strings into plain XTDB-flavoured SQL literals :slightly_smiling_face:

Unlike Postgres, which has lots of JSON-specific functionality, XTDB was able to achieve everything using the first-class support for objects and arrays.

I posted over on the r/SQL thread, and there’s also a now a dedicated subreddit r/adventofsql

Definitely looking forward to tomorrow morning :raised_hands:

Unfortunately Day 2 looks to be blocked on a lack of STRING_AGG and CHAR (and recursive CTEs - which could otherwise probably be used to work around the lack of STRING_AGG). Will update if things change again.

EDIT: close enough? :smile: