The USING clause specifies one or more same-named columns that should be used to match rows between tables.
USING can make JOIN statements shorter and clearer when the relationship columns have identical names.
Join Orders and Customers using the shared CustomerID column.
SELECT
CustomerID,
CustomerName,
OrderID
FROM Customers
INNER JOIN Orders
USING (CustomerID);
Useful in SQL dialects that support USING and in schemas with consistently named relationship columns.
- USING requires matching column names.
- It can simplify JOIN syntax.
- It avoids repeating table-qualified column names in the JOIN condition.
- Database support varies.
- Explicit ON is more widely portable.
What is the USING clause?
USING specifies same-named columns that should be used to match rows in a JOIN.
When can USING be used?
It can be used when the related columns have the same name and the database supports the syntax.