A Formal Semantics of SQL Queries, Its Validation, and Applications [pdf]
vldb.org