67% found this document useful (3 votes)
5K views

Oracle Tutorial Lesson 5 Solutions

The document contains 9 queries for the HR department to generate various reports on employees, departments, locations, and job grades from multiple database tables. The queries produce output with columns for address details, employee and department names, employee and manager names paired with their numbers, employee names and hire dates compared to other records, and more. Natural joins and ordering by employee number are used in some of the queries.

Uploaded by

susannewhite7576
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
5K views

Oracle Tutorial Lesson 5 Solutions

The document contains 9 queries for the HR department to generate various reports on employees, departments, locations, and job grades from multiple database tables. The queries produce output with columns for address details, employee and department names, employee and manager names paired with their numbers, employee names and hire dates compared to other records, and more. Natural joins and ordering by employee number are used in some of the queries.

Uploaded by

susannewhite7576
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1. WriteaqueryfortheHRdepartmenttoproducetheaddressesofallthedepartments.Usethe LOCATIONSandCOUNTRIEStables.ShowthelocationID,streetaddress,city,stateorprovince, andcountryintheoutput.UseaNATURALJOINtoproducetheresults.

2. TheHRdepartmentneedsareportofallemployees.Writeaquerytodisplaythelastname, departmentnumber,anddepartmentnameforallemployees.

3. TheHRdepartmentneedsareportofemployeesinToronto.Displaythelastname,job, departmentnumber,anddepartmentnameforallemployeeswhoworkinToronto.

4. Createareporttodisplayemployeeslastnameandemployeenumberalongwiththeir managerslastnameandmanagernumber.LabelthecolumnsEmployee,Emp#,Manager,and Mgr#,respectively.

5. Modifyquestion4todisplayallemployeesincludingKing,whohasnomanager.Orderthe resultsbytheemployeenumber.

6. CreateareportfortheHRdepartmentthatdisplaysemployeelastnames,department numbers,andalltheemployeeswhoworkinthesamedepartmentasagivenemployee.Give eachcolumnanappropriatelabel.

7. TheHRdepartmentneedsareportonjobgradesandsalaries.Tofamiliarizeyourselfwiththe JOB_GRADEStable,firstshowthestructureoftheJOB_GRADEStable.Thencreateaquery thatdisplaysthename,job,departmentname,salary,andgradeforallemployees.

8. TheHRdepartmentwantstodeterminethenamesofallemployeeswhowerehiredafter Davies.Createaquerytodisplaythenameandhiredateofanyemployeehiredafter employeeDavies.

9. TheHRdepartmentneedstofindthenamesandhiredatesforallemployeeswhowerehired beforetheirmanagers,alongwiththeirmanagersnamesandhiredates.

You might also like