Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
21 views

Assignment Multiple Row Function NEW Answers

The document contains sample SQL queries and answers. It includes questions about calculating average and total salaries, filtering results by salary ranges and conditions, counting records, and understanding the difference between HAVING and WHERE clauses.

Uploaded by

P.Padmini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Assignment Multiple Row Function NEW Answers

The document contains sample SQL queries and answers. It includes questions about calculating average and total salaries, filtering results by salary ranges and conditions, counting records, and understanding the difference between HAVING and WHERE clauses.

Uploaded by

P.Padmini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Emp

Name deptno job sal


Scott 10 Clerk 5000
Allen 10 Clerk 7000
Smith 20 Sales 8000
Tom 30 IT 6000

Q1 Display Avg sal and sum of sal of employees?

Answer: Select avg(sal), sum(sal) from emp

Q2. Display Sum of Sal, deptno of employees whose Sum of Sum sal is
in the range of 20000 to 50000

Answer: Select Sum(sal),deptno from emp group by deptno having


sum(sal) between 20000 and 50000

Q3. Display Maximum sal , deptno of employees whose maximum sal is


greater than 1000?

Answer: Select max(sal),deptno from emp group by deptno having


sum(sal)>1000

Q4. Find out how many employees have Sum of sal greater than 1000?

Answer: Select Count(name) from emp having sum(sal)>1000

Q5. Differentiate Between Having and Where Clause

Answer: Where is used to implement condition

Having is used to group and then implement condition


Q6. Display sum of sal, deptno,job of employees whose sum of sal is
greater than 3000 and their job starts with "C”

Answer: Select sum(sal),deptno,job from emp where job like ‘C%’


group by deptno,job having sum(sal)>3000

You might also like