1) Using the COMPANY schema, express the following queries in SQL. Your queries should always work without modification

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1) Using the COMPANY schema, express the following queries in SQL. Your queries should always work without modification

Post by answerhappygod »

1) Using the COMPANY schema, express the following queries in SQL. Your queries should always work without modification even if the underlying tables change via insert/update/delete operations.
1.1 Find the first name and salary of all male employees. (1 point)
1.2 For each employee, find the employee first name and the project number
he/she works on. (2 points)
1.3 Find the department name that has exactly three locations. (2 points)
Figure 5.6 One possible database state for the COMPANY relational database schema Dno 5 5 EMPLOYEE Frame Minit John B Franklin T Alicia J Jennifer Ramesh K Joyce A Ahmad James E 4 ? דה DE <> Lname San Bdate Address Sex Salary Super_san Smith 1234567891965-01-09 731 Fondren, Houston, TX M 30000 333445555 Wong 333445555 1955-12-08 638 Voss, Houston, TX M 40000 888665555 Zelaya 999887777 1968-01-19 3321 Castle, Spring, TX F 25000 987654321 Wallace 9876543211941-06-20 291 Berry, Bellaire, TX F 43000 888665555 Narayan 666884444 1962-09-15 975 Fire Oak, Humble, TX M 38000 333445555 English 453453453 1972-07-31 5631 Rice, Houston, TX F 25000 333445555 Jabbar 987987987 1969-03-29 980 Dallas, Houston, TX M 25000 087654321 Borg 888665555 1937-11-10 450 Stone, Houston, TX M 55000 NULL 4 5 5 4 1 Dnumber DEPARTMENT Dname Research Administration Headquarters 5 4 1 Mgr son 333445555 987654321 888665555 Mgr start date 1988-05-22 1995-01-01 1981-06-19 DEPT LOCATIONS Dnumber Dlocation 1 Houston 4 Stafford 5 Bellaire 5 Sugarland 5 Houston WORKS ON Esan Pno 1 2 3 PROJECT Pname ProductX ProductY Product Computerization Reorganization Newbenefits Pnumber 1 2 3 Plocation Bellaire Sugarland Houston Stafford Houston Stafford Dnum 5 5 5 1 2 louis 10 20 30 4 1 2 Hours 32.5 7.5 40.0 20.0 20.0 10.0 10.0 10.0 10.0 30.0 10.0 35.0 5.0 123456789 123456789 666884444 453453453 453453453 333445555 333445555 333445555 333445555 999887777 999887777 987987987 987987987 987654321 987654321 888665555 10 20 Sex F 30 10 9:39:19 10 DEPENDENT Essn 333445555 333445555 333445555 987654321 123456789 123456789 123456789 M F Dependent name Alice Theodore Joy Abner Michael Alice Elizabeth Bdate 1986-04-05 1983-10-25 1958-05-03 1942-02-28 1988-01-04 1988-12-30 1967-05-05 30 30 Relationship Daughter Son Spouse Spouse Son Daughter Spouse M 20.0 15.0 NULL M F 20 20 F
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply