![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZH30M1Aw_AyXJmuECcxrIpivqf_pKytYPRVngERNGMrFwCFfMCsH9Yuujy9HG7vAaigbzQRVcgQi7LeGlFTiYOar0Rd5e5pZ2x5flRt7LKyTNZwr4aYL9dycSBhSKz0qkqsN8hvE8QkYh/s400/hr.png)
These tables are from the HR schema. I'm showing two examples, one uses 'Using' and the other with the 'On.'
Select r.Region_Name
, c.Country_Name
, l.State_Province
, d.Department_Name
, e.Last_Name
, e.Job_Id
From Regions R
Join Countries C On r.Region_Id = c.Region_Id
Full Outer Join Locations L On c.Country_Id = l.Country_Id
Full Outer Join Departments D On l.Location_Id = d.Location_Id
Full Outer Join Employees E On d.Department_Id = e.Department_Id
Where r.Region_Name = 'Americas'
And c.Country_Name <> 'United States of America';
Select r.Region_Name
, c.Country_Name
, l.State_Province
, d.Department_Name
, e.Last_Name
, e.Job_Id
From Regions R
Join Countries C using ( Region_Id )
Full Outer Join Locations L using ( Country_Id )
Full Outer Join Departments D using ( Location_Id )
Full Outer Join Employees E using ( Department_Id )
Where r.Region_Name = 'Americas'
And c.Country_Name <> 'United States of America';
No comments:
Post a Comment