If several columns have the same names but the datatypes do not match, the NATURAL JOIN clause can be modified with the USING clause to specify the columns that should be used for an EQUIJOIN.
- USING Clause is used to match only one column when more than one column matches.
- NATURAL JOIN and USING Clause are mutually exclusive.
- It should not have a qualifier(table name or Alias) in the referenced columns.
- NATURAL JOIN uses all the columns with matching names and datatypes to join the tables. The USING Clause can be used to specify only those columns that should be used for an EQUIJOIN.
EXAMPLES:
We will apply the below mentioned commands on the following base tables:

Employee Table

Department Table
QUERY 1: Write SQL query to find the working location of the employees. Also give their respective employee_id and last_name?
Input : SELECT e.EMPLOYEE_ID, e.LAST_NAME, d.LOCATION_ID FROM Employees e JOIN Departments d USING(DEPARTMENT_ID); Output :![]()
Explanation: The example shown joins the DEPARTMENT_ID column in the EMPLOYEES and DEPARTMENTS
tables, and thus shows the location where an employee works.
We will apply the below mentioned commands on the following base tables:

Country Table

Location Table
QUERY 2: Write SQL query to find the location_id, street_address, postal_code and their respective country name?
Input : SELECT l.location_id, l.street_address, l.postal_code, c.country_name FROM locations l JOIN countries c USING(country_id); Output :![]()
Explanation: The example shown joins the COUNTRY_ID column in the LOCATIONS and COUNTRIES
tables, and thus shows the required details.
NOTE: When we use the USING clause in a join statement, the join column is not qualified with table Alias. Do not Alias it even if the same column is used elsewhere in the SQL statement:
Example:
Input: SELECT l.location_id, l.street_address, l.postal_code, c.country_name FROM locations l JOIN countries c USING(country_id) WHERE c.country_id'IT'; Output:![]()
Explanation: Since the column in USING Clause is used again in WHERE Clause, thus it throws an error to the user.
Recommended Posts:
- Difference between Having clause and Group by clause
- Combining aggregate and non-aggregate values in SQL using Joins and Over clause
- SQL query using COUNT and HAVING clause
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- SQL | Distinct Clause
- SQL | WHERE Clause
- SQL | SELECT TOP Clause
- SQL | Union Clause
- SQL | WITH clause
- SQL | Except Clause
- SQL | OFFSET-FETCH Clause
- SQL | LIMIT Clause
- SQL | Intersect & Except clause
- SQL | With Ties Clause
- SQL | Sub queries in From Clause
- SQL | ON Clause
- Difference between Where and Having Clause in SQL
- Difference between order by and group by clause in SQL
- Difference between From and Where Clause in SQL
- Distinct clause in MS SQL Server
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

