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');

EMP:
NUMBER (4)
EMPNO
VARCHAR2 (10)
ΕΝΑΜΕ
VARCHAR2 (9)
JOB
NUMBER (4)
MGR
HIREDATE
DATE
NUMBER (7, 2)
SAL
NUMBER (7, 2)
СOMM
NUMBER (2)
DE PTNΟ
DEPT:
NUMBER (2)
DE PTNΟ
VARCHAR2 (14)
DNAME
VARCHAR2 (13)
LOC
help_outline

Image Transcriptionclose

EMP: NUMBER (4) EMPNO VARCHAR2 (10) ΕΝΑΜΕ VARCHAR2 (9) JOB NUMBER (4) MGR HIREDATE DATE NUMBER (7, 2) SAL NUMBER (7, 2) СOMM NUMBER (2) DE PTNΟ DEPT: NUMBER (2) DE PTNΟ VARCHAR2 (14) DNAME VARCHAR2 (13) LOC

fullscreen
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 –

help_outline

Image Transcriptionclose

$sqlite3 database.sdb < main.sql HR IT

fullscreen
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...

help_outline

Image Transcriptionclose

$sqlite3 database.sdb <main.sql Error: near line 16: ambiguous column name: deptno

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

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

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: When using the Windows Firewall with Advanced Security console, three distinct network locations imp...

A: Windows firewall: It is an essential part of the layered security model provided by the windows, als...

question_answer

Q: Write a program that simulates a Magic 8-Ball. Prompt the user for a question, and randomly select a...

A: Make program and response.txt file in same directory (folder).do while loop is used to continue to p...

question_answer

Q: I need to answer for question no. 2

A: Given that the page size in the system is 4 KB. Using the table and the formulas, the following are ...

question_answer

Q: Which program is used to configure IPsec between two computers?

A: The IPsec can be configured between two computers on Windows Firewall with Advanced Security. Howeve...

question_answer

Q: DISCUSS THE BLOCKCHAIN TECHNOLOGY?

A: What is BLOCKCHAIN: ⦁ As its name suggests, its a chain of blocks or a growing list of records (reco...

question_answer

Q: Simplify the following Boolean function , using three- variable maps: d) F(x,y,z) = Σ (3,5,6,7)

A: The Boolean function is defined by the algebraic expression known as Boolean expression which contai...

question_answer

Q: A variable name in the programming language Visual Basic must begin with a letter (uppercase or lowe...

A: Answer:Number of letters (uppercase + lowercase) = 26 + 26 = 52Number of digits (0 to 9) = 10Number ...

question_answer

Q: For Javascript, the prompt asks the following: Write a function that uses alert() to display pairs o...

A: Program Approach-1)Create a function named convertTemp () with two parameters lowTemp and highTemp.2...

question_answer

Q: Describe the tools and technology used to support IT project management. What are the characteristic...

A: IT Project Management is a method for organizing the information technology development program, org...