Write the following queries in SQL on the relational database schema for COMPANY latabase given in CompanySchema.pdf. 1. Find the last name of employees who have salary greater than 30 000. 2. Find the average salary of employees who works on the projects which are located in 'Stafford'. 3. Find the total working hours of each manager. 4. Find the name of the projects on which no employee works.
Write the following queries in SQL on the relational database schema for COMPANY latabase given in CompanySchema.pdf. 1. Find the last name of employees who have salary greater than 30 000. 2. Find the average salary of employees who works on the projects which are located in 'Stafford'. 3. Find the total working hours of each manager. 4. Find the name of the projects on which no employee works.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Write the following queries in SQL on the relational database schema for COMPANY
database given in CompanySchema.pdf.
1. Find the last name of employees who have salary greater than 30 000.
2. Find the average salary of employees who works on the projects which are located in
"Stafford'.
3. Find the total working hours of each manager.
4. Find the name of the projects on which no employee works.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbb04f745-31c3-4c93-a0bd-f92149068c7f%2Fd4cedd50-7364-49da-bf14-b7424d3995c5%2Fafsphau_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Write the following queries in SQL on the relational database schema for COMPANY
database given in CompanySchema.pdf.
1. Find the last name of employees who have salary greater than 30 000.
2. Find the average salary of employees who works on the projects which are located in
"Stafford'.
3. Find the total working hours of each manager.
4. Find the name of the projects on which no employee works.
![EMPLOYEE
Frame Minit Lname Sen Bdate Address Sex Salary Super sen Dno
+444
DEPARTMENT
Dname Dnumber
Mor an Mgr start date
DEPT LOCATIONS
Dnumber Dlocation
PROJECT
Prame Prumber Plocation Dnum
WORKS ON
Ennn Pno Hoir
Hours
DEPENDENT
Esen Dependent name Se Bdate Relationship
Reforential integrity constraints displayed
on the COMFWNY relational database
schema.
One possible database state for the COMPANY relational database schema.
EMPLOYEE
Fname Minit Lname
John
Frankin T
Sex Salary
30000 333445555 5
M 40000 Jo00665555
F 25000 Joe7e54321
43000 J88Ge5556
San
Bdate
Address
Super en Dno
123456789 1965-01-09 731 Fondren, Hounton, TX M
333445555 1955-12-08 638 Voas, Houston, TX
Go0087777 1960-01-19 3321 Castle, Spring. TX
987654321 1941-06-20 291 Berry, Bellaire, TX
Narayan 666884444 1962-09-15 975 Fire Oak, Humibile, TX M
B
Smith
Wong
Zelaya
Wallace
5
Alicia
4
Jennifer
F
38000 333445655
25000 333445555
M 25000 007654321
M 55000 NULL
Ramesh
English
453453453 1972-07-31 5631 Rice, Houston, TX
F
Joyce
Ahmad
A
987987907
1969-03-29 980 Dallan, Houston, TX
B80G05555 1937-11-10 450 Stone, Houston, TX
Jabbar
4
James
E
Borg
DEPARTMENT
DEPT LOCATIONS
Dnumber
Mar atart date
Dnumber
Dlocation
Dname
Mar en
Research
333445555
1988-06-22
Houston
Administration
987654321
1995-01-01
Stafford
Headquarters
1981-06-19
Belaire
Sugarland
Houston
WORKS ON
PROJECT
Essn
Pno
Hours
Prame
Pnumber
Plocation
Dnum
123456709
123456700
325
ProductX
Bellaire
ProductY
Productz
75
Sugartand
666884444
3
40.0
3
Houston
5
453453453
20.0
Computeriation
10
Stafford
4
453453450
20.0
Reorganization
20
Houston
333445565
10.0
4
Newbenefite
30
Stafford
333445566
3
10.0
333445565
333445555
10
10.0
DEPENDENT
20
100
Esan
Dependent na
Sex
Bdate
Relationshin
30
30.0
333445555
Alice
1986-04-05
Daughter
909887777
10
10.0
333445556
Theodore
M
1983-10-25
Son
987987087
10
35.0
333445555
1958-05-03
Spouse
Spouse
Joy
007007007
987654321
30
5.0
987654321
Abner
1942-02-28
30
20.0
123456700
Michael
1988-01-04
Son
987654321
20
15.0
123450700
Alice
1988-12-30
Daughter
B88665555
20
NULL
123456789
Ekrabeth
1967-05-05
Spoune](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbb04f745-31c3-4c93-a0bd-f92149068c7f%2Fd4cedd50-7364-49da-bf14-b7424d3995c5%2Fzy6jq42_processed.jpeg&w=3840&q=75)
Transcribed Image Text:EMPLOYEE
Frame Minit Lname Sen Bdate Address Sex Salary Super sen Dno
+444
DEPARTMENT
Dname Dnumber
Mor an Mgr start date
DEPT LOCATIONS
Dnumber Dlocation
PROJECT
Prame Prumber Plocation Dnum
WORKS ON
Ennn Pno Hoir
Hours
DEPENDENT
Esen Dependent name Se Bdate Relationship
Reforential integrity constraints displayed
on the COMFWNY relational database
schema.
One possible database state for the COMPANY relational database schema.
EMPLOYEE
Fname Minit Lname
John
Frankin T
Sex Salary
30000 333445555 5
M 40000 Jo00665555
F 25000 Joe7e54321
43000 J88Ge5556
San
Bdate
Address
Super en Dno
123456789 1965-01-09 731 Fondren, Hounton, TX M
333445555 1955-12-08 638 Voas, Houston, TX
Go0087777 1960-01-19 3321 Castle, Spring. TX
987654321 1941-06-20 291 Berry, Bellaire, TX
Narayan 666884444 1962-09-15 975 Fire Oak, Humibile, TX M
B
Smith
Wong
Zelaya
Wallace
5
Alicia
4
Jennifer
F
38000 333445655
25000 333445555
M 25000 007654321
M 55000 NULL
Ramesh
English
453453453 1972-07-31 5631 Rice, Houston, TX
F
Joyce
Ahmad
A
987987907
1969-03-29 980 Dallan, Houston, TX
B80G05555 1937-11-10 450 Stone, Houston, TX
Jabbar
4
James
E
Borg
DEPARTMENT
DEPT LOCATIONS
Dnumber
Mar atart date
Dnumber
Dlocation
Dname
Mar en
Research
333445555
1988-06-22
Houston
Administration
987654321
1995-01-01
Stafford
Headquarters
1981-06-19
Belaire
Sugarland
Houston
WORKS ON
PROJECT
Essn
Pno
Hours
Prame
Pnumber
Plocation
Dnum
123456709
123456700
325
ProductX
Bellaire
ProductY
Productz
75
Sugartand
666884444
3
40.0
3
Houston
5
453453453
20.0
Computeriation
10
Stafford
4
453453450
20.0
Reorganization
20
Houston
333445565
10.0
4
Newbenefite
30
Stafford
333445566
3
10.0
333445565
333445555
10
10.0
DEPENDENT
20
100
Esan
Dependent na
Sex
Bdate
Relationshin
30
30.0
333445555
Alice
1986-04-05
Daughter
909887777
10
10.0
333445556
Theodore
M
1983-10-25
Son
987987087
10
35.0
333445555
1958-05-03
Spouse
Spouse
Joy
007007007
987654321
30
5.0
987654321
Abner
1942-02-28
30
20.0
123456700
Michael
1988-01-04
Son
987654321
20
15.0
123450700
Alice
1988-12-30
Daughter
B88665555
20
NULL
123456789
Ekrabeth
1967-05-05
Spoune
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education