Some things we could mention about USING (not sure about exact wording or placement):
- USING can be used instead of ON if the columns that are to be matched have the same name in both tables, and the comparison operator is =. Ex. ON T1.A = T2.A AND T1.B = T2.B --> USING (A, B).
- If the select list is *, the columns returned from T1 JOIN T2 USING (...) is the columns in the USING clause, followed by all the columns of T1 not referenced in USING, followed by all the columns of T2 not referenced in USING.
- If the select list contains T1., it will be expanded to all columns in T1 not referenced in USING. Same for T2..
- Columns in USING can be referenced without qualification. So given two tables T1(A,B) and T2(A,B), this is allowed:
SELECT A FROM T1 JOIN T2 USING (A)
whereas this is disallowed since the column B is not mentioned in USING and it's ambiguous which B to use:
SELECT B FROM T1 JOIN T2 USING (A)
Formally, the references to a join column A are equivalent to COALESCE(T1.A, T2.A). For inner joins, T1.A and T2.A will always be equal, but for outer joins NULLs may be filled in on one of the sides so that they are not necessarily equal. You can always specify which of the A's you want by qualifying it with the table name.