Almost any SQL guide on the web that you find will be close, although GS uses the FLAT keyword that I had not seen elsewhere.
An easy way to get some correct SQL syntax is if you already happen to have a copy of Microsoft Access. You can create a visual query there and then switch to SQL mode to see the corresponding SQL code.
AC comes with a PDF called "04 ... Calculation Guide.pdf" in the Documentation folder which has info on SQL beginning on page 52. There, it mentions that the Graphisoft ODBC documentation (on GS web site) gives the details for Graphisoft's version of SQL. We used to be able to just download this. Now they have some kind of application process:
http://www.graphisoft.com/support/developer/downloads/index.html
Karl
One of the forum moderators
AC 28 USA and earlier • macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB