0% found this document useful (0 votes)
28 views20 pages

Database Management System Assignment - DHANANJAY SINGHAL

The document contains solutions to 42 database queries on employee and department schemas. The queries include filtering, aggregation, joins and other SQL operations. Key fields queried are employee name, number, job, department, salary and other attributes.

Uploaded by

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

Database Management System Assignment - DHANANJAY SINGHAL

The document contains solutions to 42 database queries on employee and department schemas. The queries include filtering, aggregation, joins and other SQL operations. Key fields queried are employee name, number, job, department, salary and other attributes.

Uploaded by

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

UNIVERSITY OF DELHI

HANSRAJ COLLEGE
BSC (HONS) COMPUTER SCIENCE
SEMESTER - 4

DATABASE MANAGEMENT SYSTEM

DHANANJAY SINGHAL
21CS/13
Department and Employee schema:

Query 1 :
Query to display Employee Name, Job, Hire Date, Employee Number; for each employee with the
Employee Number appearing first.

Solution 1 :
Query 2 :
Query to display unique Jobs from the Employee Table.

Solution 2 :

Query 3 :
Query to display the Employee Name concatenated by a Job separated by a comma.

Solution 3 :
Query 4 :
Query to display all the data from the Employee Table. Separate each Column by a comma and
name the said column as THE_OUTPUT.

Solution 4 :

Query 5 :
Query to display the Employee Name and Salary of all the employees earning more than
$2850.

Solution 5 :
Query 6 :
Query to display Employee Name and Department Number for the Employee No= 79.

Solution 6 :

Query 7 :
Query to display Employee Name and Salary for all employees whose salary is not in the range of
$1500 and $2850.

Solution 7 :

Query 8 :
Query to display Employee Name and Department No. of all the employees in Dept 10 and Dept
30 in the alphabetical order by name.

Solution 8 :
Query 9 :
Query to display Name and Hire Date of every Employee who was hired in 1981.

Solution 9 :

Query 10 :
Query to display Name and Job of all employees who have not assigned a supervisor.

Solution 10 :

Query 11 :
Query to display the Name, Salary and Commission for all the employees who earn commission.

Solution 11 :
Query 12 :
Sort the data in descending order of Salary and Commission.

Solution 12 :

Query 13 :
Query to display Name of all the employees where the third letter of their name is ‘A’.

Solution 13 :

Query 14 :
Query to display Name of all employees either have two ‘R’s or have two ‘A’s in their name and
are either in Dept No = 30 or their Manger’s Employee No = 7788.

Solution 14 :
Query 15 :
Query to display Name, Salary and Commission for all employees whose Commission amount is
greater than their Salary increased by 5%.

Solution 15 :

Query 16 :
Query to display the Current Date along with the day name.

Solution 16 :

Query 17 :
Query to display Name, Hire Date and Salary Review Date which is the 1st Monday after six
months of employment.

Solution 17 :
Query 18 :
Query to display Name and calculate the number of months between today and the date on which
employee was hired of department ‘Purchase’.

Solution 18 :

Query 19 :
Query to display the following for each employee <E-Name> earns < Salary> monthly but wants <
3 * Current Salary >. Label the Column as Dream Salary.

Solution 19 :
Query 20 :
Query to display Name with the 1st letter capitalized and all other letter lower case and length of
their name of all the employees whose name starts with ‘J’, ’A’ and ‘M’.

Solution 20 :

Query 21 :
Query to display Name, Hire Date and Day of the week on which the employee started.

Solution 21 :
Query 22 :
Query to display Name, Department Name and Department No for all the employees.

Solution 22 :

Query 23 :
Query to display Unique Listing of all Jobs that are in Department number 30.

Solution 23 :
Query 24:
Query to display Name, Dept Name of all employees who have an ‘A’ in their name.

Solution 24 :

Query 25 :
Query to display Name, Job, Department No. And Department Name for all the employees
working at the Dallas location.

Solution 25 :
Query 26 :
Query to display Name and Employee no. Along with their supervisor’s Name and the supervisor’s
employee no; along with the Employees’ Name who do not have a supervisor.

Solution 26 :

Query 27 :
Query to display Name, Dept No. And Salary of any employee whose department No. and salary
matches both the department no. And the salary of any employee who earns a commission.

Solution 27 :
Query 28 :
Query to display Name and Salaries represented by asterisks, where each asterisk (*) signifies
$100.

Solution 28 :

Query 29 :
Query to display the Highest, Lowest, Sum and Average Salaries of all the employees.

Solution 29 :
Query 30 :
Query to display the number of employees performing the same Job type functions.

Solution 30 :

Query 31 :
Query to display the total number of supervisors without listing their names.

Solution 31 :

Query 32 :
Query to display the Department Name, Location Name, No. of Employees and the average salary
for all employees in that department.

Solution 32 :
Query 33 :
Query to display Name and Hire Date for all employees in the same dept. as Blake.

Solution 33 :

Query 34 :
Query to display the Employee No. And Name for all employees who earn more than the average
salary.

Solution 34 :
Query 35 :
Query to display Employee Number and Name for all employees who work in a department with
any employee whose name contains a ‘T’.

Solution 35 :

Query 36 :
Query to display the names and salaries of all employees who report to supervisor named ‘King’.

Solution 36 :
Query 37 :
Query to display the department no, name and job for all employees in the Sales department.

Solution 37 :

Query 38 :
Display names of employees along with their department name who have more than 20 years
experience.

Solution 38 :
Query 39 :
Display total number of departments at each location.

Solution 39 :

Query 40 :
Find the department name in which at least 20 employees work in.

Solution 40 :
Query 41 :
Query to find the employee’ name who is not supervisor and name of supervisor supervising more
than 5 employees.

Solution 41 :

Query 42 :
Query to display the job type with maximum and minimum employees

Solution 42 :

Name - DHANANJAY SINGHAL Roll No - 21CS/13

END OF ASSIGNMENT

You might also like