Knew most&#x2F;all of these tricks already, but it&#x27;s a good summary of some useful tricks.<p>Just one thing...<p>&quot;Common Table Expressions (also: CTE, also referred to as subquery factoring, e.g. in Oracle) are the only way to declare variables in SQL (apart from the obscure WINDOW clause that only PostgreSQL and Sybase SQL Anywhere know).&quot;<p>Can&#x27;t say anything about other vendors, but in T-SQL (a.k.a. MS SQL) creating variables is easily done via the DECLARE keyword, e.g. DECLARE @x INT = 4; . You can create a number of structures this way, including temporary tables (there are few different types of temporary tables, but the ones specified with DECLARE are specific to the scope in which they were defined in).<p>Does the DECLARE keyword (or something similar) not exist within any of the SQL standards?