Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. If an employee works on all the project 1, 2, and 3, then list the social security number of the employee. 2. Retrieve the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed1. If an employee works on all the project 1, 2, and 3, then list the social security number of the employee. 2. Retrieve the social security numbers of all direct and indirect supervisees James Borg has. 3. List the names of departments, and the total number of employees with salaries greater than $30,000, and only those departments with more than one employee. 4. List the names of departments that have more than one employee who earns more than $30,000.

Write and execute the query in SQL and please include query number, query statement, and query execution result for each query.

SQL> select * from jps. employee; NAME SSN BDATE SEX SALARY SUPERSSN DNO John B Smith Franklin I Wong Alicia u Zelaya Jennifer S Wallace Ramesh K Narayan Joyce A English Ahmad V Jabbar James E Borg 123456789 09-JAN-55 M 333445555 08-DEC-45 M 999887777 19-JUL-85 F 987654321 20-JUN-31 F 666884444 15-SEP-52 M 453453453 31-JUL-62 F 987987987 29-MAR-59 M 888665555 10-NOV-27 M 30000 333445555 5 40000 888665555 5 25000 987654321 4 43000 888665555 4 38000 333445555 5 25000 333445555 5 25000 987654321 4 55000 1 8 rows selected. SQL> select * from jps. department; DNAME DNUMBER MGRSSN MGRSTARTD 5 Research Administration Headquarters 4 1 333445555 22-MAY-78 987654321 01-JAN-85 888665555 19-JUN-71 SQL> select * from jps.project; PNAME PNUMBER PLOCATION DNUM ProductX 1 ProductY 2 Productz 3 Computerization 10 Reorganization 20 Newbenefits 30 Bellaire Sugarland Houston Stafford Houston Stafford 5 5 5 4 1 4 6 rows selected. SQL> select * from jps.deptlocation; DNUMBER DLOCATION 1 4 5 5 5 Houston Stafford Bellaire Houston Sugarland SQL> select * from jps.workson; ESSN PNO HOURS 1234567891 123456789 2 666884444 3 453453453 1 453453453 2 333445555 2 333445555 3 333445555 10 333445555 20 999887777 30 999887777 10 32.5 7.5 40 20 20 10 10 10 10 30 10 ESSN PNO HOURS 987987987 10 987987987 30 987654321 30 987654321 20 888665555 20 35 5 20 15 16 rows selected. SQL> select * from jps. dependent; ESSN DEPENDENTNAME SEX BDATE RELATIONSHIP 333445555 Alice 333445555 Theodore 333445555 Joy 987654321 Abner 123456789 Michael 123456789 Alice 123456789 Elizabeth F M F M M F F 05-APR-76 Daughter 25-OCT-73 Son 03-MAY-48 Spouse 29-FEB-32 Spouse 01-JAN-78 Son 31-DEC-78 Daughter 05-MAY-57 Spouse 7 rows selected. > SQL> describe jps. employee; Name Null? Type NAME SSN BDATE SEX SALARY SUPERSSN DNO NOT NULL VARCHAR2 (19) NOT NULL CHAR (9) DATE CHAR (3) NUMBER (8,2) CHAR(9) VARCHAR2 (8) SQL> describe jps. department; Name Null? Type DNAME DNUMBER MGRSSN MGRSTARTDATE NOT NULL VARCHAR2 (15) NOT NULL VARCHAR2 (8) CHAR (9) DATE SQL> describe jps. project; Name Null? Type PNAME PNUMBER PLOCATION DNUM NOT NULL VARCHAR2 (15) NOT NULL VARCHAR2 (8) VARCHAR2 (15) VARCHAR2 (8) SQL> describe jps.deptlocation; Name Null? Type DNUMBER DLOCATION NOT NULL VARCHAR2 (8) NOT NULL VARCHAR2 (15) SQL> describe jps.workson; Name Null? Type ESSN PNO HOURS NOT NULL CHAR (9) NOT NULL VARCHAR2 (8) NUMBER (5,1) SQL> describe jps. dependent; Name Null? Type ESSN DEPENDENTNAME SEX BDATE RELATIONSHIP NOT NULL CHAR (9) NOT NULL VARCHAR2 (15) CHAR (3) DATE VARCHAR2 (12)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago