CBSE Class 12 Informatics Practices Question 36 of 44

Solved 2025 Sample Question Paper CBSE Class 12 Informatics Practices (065) — Question 5

Back to all questions
5
Question

Question 32(A)

Consider the following tables:

Table 1:

EMPLOYEE which stores Employee ID (EMP_ID), Employee Name (EMP_NAME), Employee City (EMP_CITY)

Table 2:

PAYROLL which stores Employee ID (EMP_ID), Department (DEPARTMENT), Designation (DESIGNATION), and Salary (SALARY) for various employees.

Note: Attribute names are written within brackets.

Table: EMPLOYEE

EMP_IDEMP_NAMEEMP_CITY
1ABHINAVAGRA
2KABIRFARIDABAD
3ESHANOIDA
4PAULSEOUL
5VICTORIALONDON

Table: PAYROLL

EMP_IDDEPARTMENTDESIGNATIONSALARY
1SALESMANAGER75000
2SALESASSOCIATE50000
3ENGINEERINGMANAGER95000
4ENGINEERINGENGINEER70000
5MARKETINGMANAGER65000

Write appropriate SQL queries for the following:

I. Display department-wise average Salary.

II. List all designations in the decreasing order of Salary.

III. Display employee name along with their corresponding departments.

Answer

I.

SELECT DEPARTMENT, AVG(SALARY) 
FROM PAYROLL 
GROUP BY DEPARTMENT; 

II.

SELECT DESIGNATION 
FROM PAYROLL 
ORDER BY SALARY DESC; 

III.

SELECT EMP_NAME, DEPARTMENT 
FROM EMPLOYEE E, PAYROLL P 
WHERE E.EMP_ID = P.EMP_ID;