# EMP:NUMBER (4)EMPNOVARCHAR2 (10)ΕΝΑΜΕVARCHAR2 (9)JOBNUMBER (4)MGRHIREDATEDATENUMBER (7, 2)SALNUMBER (7, 2)СOMMNUMBER (2)DE PTNΟDEPT:NUMBER (2)DE PTNΟVARCHAR2 (14)DNAMEVARCHAR2 (13)LOC

Question
Asked Dec 2, 2019
121 views

(select all that apply) Find the department located in Dallas and also have over two employees.

A) select dname from dept, emp where dept.deptno = emp.deptno and loc='DALLAS' group by dname
having count(*) > 2;
B) select dname from dept, emp where dept.deptno = emp.deptno and loc='DALLAS' group by deptno
having count(*) > 2;
C) (select deptno from emp group by deptno having count(*) > 2) intersect (select deptno from dept where
loc='DALLAS');
D) (select * from emp group by deptno having count(*) > 2) intersect (select * from dept where
loc='DALLAS');

check_circle

## Expert Answer

Step 1

Create the tables, insert the values, and run the given queries.

Since all the given queries are written to give the same output, but still some errors are there in the given queries.

Creating the tables –

CREATE TABLE EMP(EMPNO NUMBER(4) PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2)); CREATE TABLE DEPT(DEPTNO NUMBER(2), DNAME VARCHAR2(14), LOC VARCHAR2(13));

Inserting the values -

INSERT INTO EMP VALUES(01, 'AAA', 'HR', 1111, 01-01-11, 10000, 10000, 01);INSERT INTO EMP VALUES(02, 'BBB', 'HR', 1111, 01-01-11, 10000, 10000, 01);INSERT INTO EMP VALUES(03, 'CCC', 'HR', 1111, 01-01-11, 10000, 10000, 01); INSERT INTO DEPT VALUES(01, 'IT', 'DALLAS');INSERT INTO DEPT VALUES(01, 'HR', 'DALLAS');

Step 2

In query A, everything is right and will display the required output.

Output –

Step 3

In query B, this query will also display the required output, but the error is the table is not mentioned in after group b...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

### Programing Language

© 2020 bartleby. All Rights Reserved.