SQL | USING Clause
Improve
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.

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 :![]()

Country Table

Location Table
Input : SELECT l.location_id, l.street_address, l.postal_code, c.country_name FROM locations l JOIN countries c USING(country_id); Output :![]()
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:![]()
Share your thoughts in the comments

