USING can specify multiple columns when a relationship depends on a combination of same-named columns.
Some business keys are composite and require more than one column to uniquely identify a matching record.
Match records using both BranchID and AccountType.
SELECT
BranchID,
AccountType,
AccountNumber
FROM Accounts
INNER JOIN AccountBalances
USING (BranchID, AccountType);
Used in financial systems, regional data, composite business keys, and multi-column relationships.
- Multiple columns can form a composite relationship.
- All specified USING columns participate in the match.
- Column names must match.
- Composite keys require careful validation.
- A partial key can create incorrect matches.
Can USING contain multiple columns?
Yes. Multiple same-named columns can be specified to form a composite JOIN condition.
Why use multiple JOIN columns?
Some relationships require a combination of columns to uniquely identify the matching record.