DATABASE SYSTEMS PLEASE HELP ME FOR QUESTIONS 1 THRU 2 SHOW THE QUERY AND THE RE
ID: 3731155 • Letter: D
Question
DATABASE SYSTEMS
PLEASE HELP ME
FOR QUESTIONS 1 THRU 2 SHOW THE QUERY AND THE RESULTS OF THE QUERY (OUTPUT). ALSO, SHOW THE COMMANDS TO CREATE EACH TABLE (DDL COMMANDS) AND THE INSERTION OF THE DATA FOR EACH TABLE (DML COMMANDS).
Question 2: SQL (40 points) Use the following database to answer all parts of this question: Table: EMP Primary Key: E NO E NO E NAME E DEPT E RATHE $400.00 $200.00 $150.00 $150.00 S120.00 $100.00 $100.00 $50.00 $50.00 $50.00 $150.00 3 10 Table: PART Primary Key: P NO P NO P NAME P1 P2 P3 P4. P5 P6 P CITY NY SF NY Table: PROJECT Primary Key: PR NOExplanation / Answer
DDL Statements (Create Table Statements) :-
DML Statements (Insert statements) :-
One insert statement for each table has given. Use the insert statement for that table and change the data each time after executing the statement
1. select sum(w.HRS*e.E_RATE) as Amount,p.PR_NO from EMPLOYEE e,PROJECT p,WORK w where e.E_NO=w.E_NO and w.PR_NO=p.PR_NO group by PR_NO;
Output:-
This query retrieves the project name and the amount billed for that project. First it calculates the individaul employee work hours with rate and then it check for the project employee owrk upon and then it checks with the project table for its existence and then it groups the results according to the project.
2. select sum(sum(w.HRS*e.E_RATE)) as REVENUE ,p.PR_DEPT from EMP e, WORK w,PROJECT p where e.E_NO=w.E_NO and w.PR_NO=p.PR_NO group by p.PR_DEPT;
This query retrives the revenue generated by each department .
Amount p.PR_NO 5800 1 6400 2 2400 3Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.