Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the number of employees and the total salary for employees in department 20? Do not include commission. DROP TABLE EMP; DROP TABLE DEPT;

  1. What is the number of employees and the total salary for employees in department 20? Do not include commission.

DROP TABLE EMP; DROP TABLE DEPT;

CREATE TABLE DEPT (DEPTNO NUMBER(2) CONSTRAINT PK_DEPT_DEPTNO PRIMARY KEY, DNAME VARCHAR2(14), LOC VARCHAR2(13) );

INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK'); INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS'); INSERT INTO DEPT VALUES (30,'SALES','CHICAGO'); INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');

CREATE TABLE EMP (EMPNO NUMBER(4) CONSTRAINT PK_EMP_EMPNO PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) CONSTRAINT FK_EMP_DEPTNO REFERENCES DEPT(DEPTNO));

INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,'17-DEC-2015',1950,NULL,20); INSERT INTO EMP VALUES (7499,'ALLEN','SALES',7698,'20-FEB-2015',2600,3000.79,30); INSERT INTO EMP VALUES (7521,'WARD','SALES',7698,'22-FEB-2014',2950,5051.85,30); INSERT INTO EMP VALUES (7566,'JONES','MANAGER',7839,'2-APR-2014',7975,NULL,20); INSERT INTO EMP VALUES (7654,'MARTIN','SALES',7698,'28-SEP-2014',2250,2853.51,30); INSERT INTO EMP VALUES (7698,'BLAKE','MANAGER',7839,'1-MAY-2015',7850,NULL,30); INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,'9-JUN-2014',8450,NULL,10); INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,'09-DEC-2016',6000,NULL,20); INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,'17-NOV-2014',10500,NULL,10); INSERT INTO EMP VALUES (7844,'TURNER','SALES',7698,'8-SEP-2015',2500,0,30); INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,'12-JAN-2016',1700,NULL,20); INSERT INTO EMP VALUES (7900,'JAMES','CLERK',7698,'3-DEC-2014',2250,NULL,30); INSERT INTO EMP VALUES (7902,'FORD','ANALYST',7566,'3-DEC-2015',6000,NULL,20); INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,'01-JAN-2017',2000,NULL,10);

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

explain the movement the diagram QQQQQQD= I M= QQQQQQD= I M=

Answered: 1 week ago