Find the range of salaries (min, max) of each department in the following table:EMP(EID, ENAME, SAL, DEPT)A) select min(sal), max(sal) from emp group by deptno;B) select min(sal), max(sal) from emp group by dept;C) select min(sal) as min, max(sal) as max from employees group by deptD) select range(sal) from emp group by dept;

Question
Asked Nov 12, 2019
106 views

Find the range of salaries (min, max) of each department in the following table:
EMP(EID, ENAME, SAL, DEPT)
A) select min(sal), max(sal) from emp group by deptno;
B) select min(sal), max(sal) from emp group by dept;
C) select min(sal) as min, max(sal) as max from employees group by dept
D) select range(sal) from emp group by dept;

check_circle

Expert Answer

Step 1

EMP is the name of the table Employee.

EMP table has four rows named EID, ENAME, SAL, and DEPT.

 

Find the correct option which finds the range of salaries in min and max of each department.

Step 2

Let’s create a dummy database.

Syntax for creating table in database:

Create table tableName(columnName1 dataType, columnName2 dataType);

Example to create a table named EMP with four columns:

create table EMP(EID integer, ENAME varchar(30), SAL integer, DEPT varchar(30));

 

Syntax to insert data in table EMP

Insert into tableName( columnName1, columnName2) values (value1, value2);

Example to insert data in table EMP:

insert into EMP(EID, ENAME, SAL, DEPT) values(101, "ABC", 10000, "IT");

insert into EMP(EID, ENAME, SAL, DEPT) values(102, "BCD", 8050, "IT");

insert into EMP(EID, ENAME, SAL, DEPT) values(103, "CDE", 12560, "IT");

insert into EMP(EID, ENAME, SAL, DEPT) values(104, "DEF", 6300, "MARKETING");

insert into EMP(EID, ENAME, SAL, DEPT) values(105, "EFG", 9610, "MARKETING");

 

display the data of table EMP:

select * from EMP;

101 ABC 10000| IT
102 BCD 8050|IT
103 CDE 12560|IT
104 DEF 6300|MARKETING
195 EFG 9610 MARKETING
help_outline

Image Transcriptionclose

101 ABC 10000| IT 102 BCD 8050|IT 103 CDE 12560|IT 104 DEF 6300|MARKETING 195 EFG 9610 MARKETING

fullscreen
Step 3

The given syntax in option A is:

select min(sal), max(sal) from emp group by deptno;
In table EMP no column has named as deptno.

hence option A is incorrect.

 

The given syntax in option C is:

select min(sal) as min, max(sal) as max from employees group by dept

In this syntax, the name of the table is employees, which is incorrect.

The name of the table is EMP.

hence option C is incorrect.

 

 

The given syntax in option D is:

select range(sal) from emp group by d...

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

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: Using the SQL GROUP BY phrase with a SELECT statement can help detect which of thefollowing problems...

A: This question is based on SQL language . To know the right option of this question first a user must...

question_answer

Q: Draw the EER diagrams for the following problems using UML notation, Crow’s Foot notation and Chen n...

A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...

question_answer

Q: In Python Use the Design Recipe to write a function bools_2_str, which consumes a list of booleans a...

A: Create a Boolean list with true and false value such as:boolList = [True, True, False, True, False, ...

question_answer

Q: Design a reasonably efficient algorithm for solving each of the following problems and determine its...

A: Algorithm to find who failed to pay telephone billFor finding who failed to pay telephone bill, firs...

question_answer

Q: How does a honeypot fit in with the security provided by a firewall and intrusion detection system?

A: Honeypot in terms of cybersecurity:It is a part of the intrusion detection system and firewall that ...

question_answer

Q: In C++ Language: Write a function SummOdd that will find the sum of all elements of add order a1+ a3...

A: As it is not clear in the question that sum of odd order for the arr[]={ 8,6,4,2,3,5} is 8 (3+5=8 i....

question_answer

Q: How many lines does his algorithm print? Write a recurrence and solve it.function printaton(n: an in...

A: The given program splits into three subprograms with half of the input size each and then prints n^4...

question_answer

Q: I have tried this  a few times and cannot figure it out. This is for python.

A: The sub lists can be printed by printing each row; hence the answer would be:for i in range(len(tabl...

question_answer

Q: 3. Use a trace table to show what is the output of the following program? #include using namespace ...

A: As per the policy we are required to answer only one question.Solution for question 3 is as follows:...