https://www.dbpro.app/blog/chess-in-pure-sql