Really the the only issue I have with SQL is NULL != NULL. This creates an impedance mismatch with most languages... MySQL sort of solves this problem with a operator, which I wish was the default for ORMs to use. There are a lot of other minor nitpicks but a lot of criticisms come down to the actual RDMS not SQL itself.
I consider myself a fan of SQL, but my nitpick is more around named calculated columns. For instance: SELECT AVG(col1) OVER (PARTITION BY col2) AS partcol1 FROM tbl WHERE AVG(col1) OVER (PARTITION BY col2) > 10.0 I wish I could just do: SELECT AVG(col1) OVER (PARTITION BY col2) AS partcol1 FROM tbl WHERE partcol1 > 10.0 But I can't, because the WHERE clause is processed before the SELECT clause. So if I have a bunch…
For example, your example would have been more naturally expressed as
SELECT partcol1
FROM (tbl WITH partcol1 AS AVG(col1) OVER (PARTITION BY col2))
WHERE partcol1 > 10.0