Encontrar toda la informacion del departamento;
SELECT d.DEPARTMENT_ID, d.DEPARTMENT_NAME, r.REGION_NAME, l.STATE_PROVINCE, c.COUNTRY_NAME FROM departments d, regions r, locations l, countries c
WHERE d.LOCATION_id = l.LOCATION_id and l.COUNTRY_ID = c.COUNTRY_ID and r.region_id=c.region_id;
| DEPARTMENT_ID | DEPARTMENT_NAME | REGION_NAME | STATE_PROVINCE | COUNTRY_NAME |
|---|---|---|---|---|
| 10 | Administration | Americas | Washington | United States of America |
| 20 | Marketing | Americas | Ontario | Canada |
| 50 | Shipping | Americas | California | United States of America |
| 60 | IT | Americas | Texas | United States of America |
| 80 | Sales | Europe | Oxford | United Kingdom |
| 90 | Executive | Americas | Washington | United States of America |
| 110 | Accounting | Americas | Washington | United States of America |
| 190 | Contracting | Americas | Washington | United States of America |
8 rows selected. ESTE ES EL RESULTADO
| DEPARTMENT_ID | DEPARTMENT_NAME | MANAGER_ID | LOCATION_ID |
|---|---|---|---|
| 10 | Administration | 200 | 1700 |
| 20 | Marketing | 201 | 1800 |
| 50 | Shipping | 124 | 1500 |
| 60 | IT | 103 | 1400 |
| 80 | Sales | 149 | 2500 |
| 90 | Executive | 100 | 1700 |
| 110 | Accounting | 205 | 1700 |
| 190 | Contracting | 1700 |
8 rows selected.
| REGION_ID | REGION_NAME |
|---|---|
| 1 | Europe |
| 2 | Americas |
| 3 | Asia |
| 4 | Middle East and Africa |
4 rows selected.
| LOCATION_ID | STREET_ADDRESS | POSTAL_CODE | CITY | STATE_PROVINCE | CO |
|---|---|---|---|---|---|
| 1400 | 2014 Jabberwocky Rd | 26192 | Southlake | Texas | US |
| 1500 | 2011 Interiors Blvd | 99236 | South San Francisco | California | US |
| 1700 | 2004 Charade Rd | 98199 | Seattle | Washington | US |
| 1800 | 460 Bloor St. W. | ON M5S 1X8 | Toronto | Ontario | CA |
| 2500 | Magdalen Centre, The Oxford Science Park | OX9 9ZB | Oxford | Oxford | UK |
5 rows selected.
| CO | COUNTRY_NAME | REGION_ID |
|---|---|---|
| CA | Canada | 2 |
| DE | Germany | 1 |
| UK | United Kingdom | 1 |
| US | United States of America | 2 |
4 rows selected.