Determine the answer (give the data that results from interpreting) for the SQL
ID: 3671950 • Letter: D
Question
Determine the answer (give the data that results from interpreting) for the SQL queries below.
Part 1
1. select plocation, count(distinct pnumber)
from works_on, projects where pno = pnumber
group by plocation;
2. select plocation, count(distinct pnumber)
from works_on, projects where pno = pnumber
group by plocation having count(distinct pnumber) = 2;
3. select plocation, pname, sum(hours)
from works_on, projects
where pno = pnumber
group by pname, plocation;
4. select plocation, pname, sum(hours)
from works_on, projects
where pno = pnumber
group by pname, plocation having min(hours) > 10;
Part 2
The join of projects, works_on, and employee is computed in the table below.
1. select pnumber, max(salary)
from projects, works_on, employee
where ssn = essn and pnumber = pno
group by pnumber
having max (salary) < 43000;
2. select pname, pnumber, min(salary)
from projects, works_on, employee
where ssn = essn and pnumber = pno
group by pname, pnumber
having min(salary) < 30000;
WinRDB1 ile Edit Schema Window So Untitled 1.sql select* from works_on, projects where pno pnumber essn/char pnonumeric hoursinumeric pname/char pnumber/numeric plocation/chardnum/numeric 123456789 32.5 7.5 40 20 20 10 10 10 10 30 Product Producty Productz Productr ProductY ProductY Productz Computerization'10 Reorganization' 20 Newbenefits' 30 Bellaire Sugarland' 5 Houston'5 Bellaire Sugarland' 5 Sugarland' 15 Houston 5 Stafford' Houston'1 Stafford Stafford Stafford 'Stafford' 'Stafford Houston' 1 Houston'1 Houston' 5 2345678911 123456789' 2 6668844443 453453453'1 4534534532 333445555'2 3334455553 333445555' 10 333445555 10 333445555'20 999887777 30 999887777 10 98798798710 987987987 30 987654321'30 987654321 20 888665555 20 123456789 3 4 4 Computerization 10 Computerization 10 Newbenefits' 30 Newbenefits 30 Reorganization' 20 Reorganization' 20 Product 35 20 15 15Explanation / Answer
1.PLOCATION COUNT
BELLAIRE 1
HOUSTON 2
STRAFFORD 2
SUGARLAND 1
2.PLOCATION COUNT
HOUSTON 2
STRAFFORD 2
3.GROUP BY PNAME:
PLOCATION PNAME SUM(hours)
STRAFFORD COMPUTERIZATION 55
STRAFFORD NEWBENEFITS 55
BELLAIRE PRODUCTX' 52.5
SUGARLAND PRODUCTY' 37.5
HOUSTON PRODUCTZ' 65
HOUSTON REORGANIZATION 25
GROUP BY PLOCATION:
PLOCATION PNAME SUM(hours)
BELLAIRE PRODUCTX' 52.5
HOUSTON PRODUCTZ' 65
HOUSTON REORGANIZATION 25
STRAFFORD COMPUTERIZATION 55
STRAFFORD NEWBENEFITS 55
SUGARLAND PRODUCTY' 37.5
4.
.GROUP BY PNAME:
PLOCATION PNAME SUM(hours)
STRAFFORD COMPUTERIZATION 35
STRAFFORD NEWBENEFITS 50
BELLAIRE PRODUCTX' 52.5
SUGARLAND PRODUCTY' 20
HOUSTON PRODUCTZ' 55
HOUSTON REORGANIZATION 15
GROUP BY PLOCATION:
PLOCATION PNAME SUM(hours)
BELLAIRE PRODUCTX' 52.5
HOUSTON PRODUCTZ' 55
HOUSTON REORGANIZATION 15
STRAFFORD COMPUTERIZATION 35
STRAFFORD NEWBENEFITS 50
SUGARLAND PRODUCTY' 20
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.