USING is an ANSI-SQL keyword that appears in two major contexts.1. JOIN ... USING (col1, col2) – Replaces a verbose ON clause when the joined tables share identically named columns. The database automatically builds an equality predicate for every listed column and removes duplicated columns from the result set, returning only one copy of each USING column.2. MERGE ... USING source_table – Supplies the source table, view, or sub-query that will be compared to the target table during an upsert operation.Behavior:- Equivalent to writing ON t1.col = t2.col AND ...- The join type (INNER, LEFT, RIGHT, FULL) determines which unmatched rows appear.- Column disambiguation: after the join, the USING columns are referenced without qualification; other columns still need table aliases if ambiguous.- In MERGE, the USING clause acts similarly to the FROM clause, exposing source columns to the match condition and action clauses.Caveats:- All listed columns must exist in both tables and have comparable data types.- USING cannot mix with ON in the same JOIN level.- Some databases (e.g., SQL Server) support USING only inside MERGE, not JOIN.
column_list
(list) - One or more column names existing in both joined tables, used to build equality predicates.source_table
(table) - view|||subquery|||Dataset compared to the target during the merge.alias
(identifier) - Optional name to reference the source rows.SQL:1999
PostgreSQL, MySQL, MariaDB, Oracle, SQLite, Snowflake, BigQuery, DuckDB, and others. SQL Server is the main hold-out.
The SQL standard defines USING to coalesce the matched columns into one, because their values are guaranteed to be equal. This keeps result sets tidy.
NATURAL JOIN automatically takes all identically named columns, which can be dangerous. USING forces you to list the columns explicitly, making intent clear and predictable.
Yes. After the join, the column is unqualified. You can still qualify it if you prefer, but it is not required.