Option 2: with clause

BigQueryDb2 (LUW)MariaDBMySQLOracle DBPostgreSQLSQL ServerSQLite20092011201320152017201920212023✓ 3.8.3 - 3.50.0⊘ 3.5.7 - 3.7.11✓ 2022+a✓ 2008R2 - 2019✓ 8.4 - 17⊘ 8.3✓ 11gR2 - 23.9⊘ 11gR1✓ 8.0.11 - 9.3.0⊘ 5.0 - 5.7✓ 10.2 - 12.0.2⊘ 5.1 - 10.1✓ 9.7 - 12.1.2⊘ 2.0
  1. Only allowed at the very begin of a statement. E.g. with...insert...select.