Class - 12 CBSE Computer Science Important Output Questions 2025
With reference to the table below, answer the questions that follow :
Table : Employees
Empid | Firstname | Lastname | Address | City |
---|---|---|---|---|
010 | Ravi | Kumar | Raj nagar | GZB |
105 | Harry | Waltor | Gandhi nagar | GZB |
152 | Sam | Tones | 33 Elm St. | Paris |
215 | Sarah | Ackerman | 440 U.S. 110 | Upton |
244 | Manila | Sengupta | 24 Friends street | New Delhi |
300 | Robert | Samuel | 9 Fifth Cross | Washington |
335 | Ritu | Tondon | Shastri Nagar | GZB |
400 | Rachel | Lee | 121 Harrison St. | New York |
441 | Peter | Thompson | 11 Red Road | Paris |
Table : EmpSalary
Empid | Salary | Benefits | Designation |
---|---|---|---|
010 | 75000 | 15000 | Manager |
105 | 65000 | 15000 | Manager |
152 | 80000 | 25000 | Director |
215 | 75000 | 12500 | Manager |
244 | 50000 | 12000 | Clerk |
300 | 45000 | 10000 | Clerk |
335 | 40000 | 10000 | Clerk |
400 | 32000 | 7500 | Salesman |
441 | 28000 | 7500 | Salesman |
Give the Output of following SQL commands :
(i) Select firstname, Salary from Employees, Empsalary where Designation = 'Salesman' and Employees.Empid = Empsalary.Empid ;
(ii) Select count(distinct designation) from EmpSalary ;
(iii) Select designation, sum(salary) from EmpSalary group by designation having count(*) > 2 ;
(iv) Select sum(Benefits) from EmpSalary where Designation = 'Clerk' ;
SQL Joins & Grouping
5 Likes
Answer
(i)
Output
+-----------+--------+
| FIRSTNAME | SALARY |
+-----------+--------+
| RACHEL | 32000 |
| PETER | 28000 |
+-----------+--------+
(ii)
Output
+-----------------------------+
| COUNT(DISTINCT DESIGNATION) |
+-----------------------------+
| 4 |
+-----------------------------+
(iii)
Output
+-------------+-------------+
| DESIGNATION | SUM(SALARY) |
+-------------+-------------+
| MANAGER | 215000 |
| CLERK | 135000 |
+-------------+-------------+
(iv)
Output
+---------------+
| SUM(BENEFITS) |
+---------------+
| 32000 |
+---------------+
Answered By
1 Like