0% found this document useful (0 votes)
8 views4 pages

SQL Exercises for Database Lab BSIT-4

The document outlines 13 SQL exercises to retrieve and analyze data from database tables including getting employee data, counting employees, finding minimum and maximum salaries, calculating net salaries, finding departments employees belong to, filtering for salesmen, finding employees in a department, calculating annual salaries, counting departments, filtering salaries between values, joining employee and manager data, averaging salaries, and summing total salaries.

Uploaded by

awais
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)
8 views4 pages

SQL Exercises for Database Lab BSIT-4

The document outlines 13 SQL exercises to retrieve and analyze data from database tables including getting employee data, counting employees, finding minimum and maximum salaries, calculating net salaries, finding departments employees belong to, filtering for salesmen, finding employees in a department, calculating annual salaries, counting departments, filtering salaries between values, joining employee and manager data, averaging salaries, and summing total salaries.

Uploaded by

awais
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

CSL-220: Database

Management System Lab

Semester BS (IT) – 04

Lab 01: Foundation statements of SQL

Exercise

1. Get empno, ename, sal, deptno from emp table.

2. Count total number of employees.

3. Get the highest and the lowest salary from emp table.

Department of Computer Sciences Semester BSIT-4


CSL-220:Database Management System Lab Lab 02: Querying Database Tables
CSL-220: Database
Management System Lab

Semester BS (IT) – 04

4. Calculate net salaries of employee (by adding salary and comm).

5. Display all the deptno that employees belong to, but don’t allow repetition.

6. Display data of all employees who work as Salesman.

7. Display names
of employees who
work in deptno
20.

Department of Computer Sciences Semester BSIT-4


CSL-220:Database Management System Lab Lab 02: Querying Database Tables
CSL-220: Database
Management System Lab

Semester BS (IT) – 04

8. Calculate one year salary of every employee from emp table.

9. Display the total count of departments from dept table.

10. Display the employee name whose salary is more than 2000 but less than 3500.

11. Display all employee names and their manager number from emp table.

Department of Computer Sciences Semester BSIT-4


CSL-220:Database Management System Lab Lab 02: Querying Database Tables
CSL-220: Database
Management System Lab

Semester BS (IT) – 04

12. Show the average salary of all employees.

13. Show the total salary of all employees.

Department of Computer Sciences Semester BSIT-4


CSL-220:Database Management System Lab Lab 02: Querying Database Tables

You might also like