0% found this document useful (0 votes)
100 views35 pages

Case Study + Assignment 4,5,6 (DBMS)

The document describes a student's database lab assignments involving creating tables, inserting data, writing queries to retrieve and manipulate data. It includes multiple queries with outputs to retrieve employee data by name, ID, department, salary and other fields using functions, joins, grouping and subqueries. The assignments cover skills with creating and querying database tables to store and extract useful information.

Uploaded by

Dasah
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)
100 views35 pages

Case Study + Assignment 4,5,6 (DBMS)

The document describes a student's database lab assignments involving creating tables, inserting data, writing queries to retrieve and manipulate data. It includes multiple queries with outputs to retrieve employee data by name, ID, department, salary and other fields using functions, joins, grouping and subqueries. The assignments cover skills with creating and querying database tables to store and extract useful information.

Uploaded by

Dasah
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/ 35

SADIK SAIFI 2101816 (13-B) BCA (IV sem)

CASE STUDY - 1

Creating a Database.

Creating Table Case_Course

Inserting Data into Table Case_Course

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Creating Table Case_Student

Inserting Data into Table Case_Student

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Creating Table Case_Faculty

Inserting Data into Table Case_Faculty

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

1.
Query

Output

2.
Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

3.
Query

Output

LAB ASSIGNMENT - 4

Queries based on single row character functions

Creating Table Emp

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q1. List the Enames those are having five characters in their first names.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q2. List the Enames those are starting with ‘S’ and with five characters in their firstname.

Query

Output

Q3. List the Five character names starting with ‘S’ and ending with ‘H’.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q4. Display the employee last_name concatenated with first_name, the length of the
employee last_name .

Query

Output

Q5. Display the numeric position of the letter ‘a’ in employee last name for all the employees
who have the string REP contained in the jobid starting at the fourth position of the job id.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q6. Write a query that displays the employee’s last names with the first letter capitalized &
all other letters lowercase & length of the names for all employees whose name stats with J,
A or M. Also sort the results by employees last name.
Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q7. Calculate the remainder of a salary after it is divided by 5000 for all employees whose
job_id is SA_REP.
Query

Output

Q8. For each employee, display the employee number, last_name & salary increased by
15% & expresses as a whole number.
Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q9. Create a query to display the last name & salary for all employees. Format the salary to
be 15 characters long, left padded with $. Label the column Salary.

Query

Output

Q 10. Calculate the job experience of all employees. Display it with hiredate and the new
column heading Experience in months and experience in years.

Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

Q11. Display the employee number, hiredate, number of months employed, six month
review date, first Friday after hire date and last day of the hiremonth for all employees.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q12. Display the employees last name & calculate the number of months between today &
date the employee was hired. Label this column as months_worked.
Query

Output

Q13. Display the names & hiredate along with the time of all the employees who joined on
May 24,1999.
Query

Output

Q14. To find employees hired before 1990.

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Query

Output

Q15. Display each employee last name, hire date & day of the week on which the employee
started. Order the results by the day of the week .
Query

Output

Q16. Create a query that display the employees last name & comm. Amounts. If an
employee does not earn commission put, ”No commission”
Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

Q17. Create a query to calculate the annual salary and annual compensation of all the
employees.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q18. Create a query that display the employees last name & manager_id . If an employee
does not have manager display , ”No manager”.
Query

Output

LAB ASSIGNMENT - 5

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Assignment on group functions

Q1. List minimum , maximum , average salaries of employees.

Query

Output

Q2. Find how many job titles are available in employee table.

Query

Output

Q3. What is the difference between maximum and minimum salaries of employees in the
organisation?

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q4. Find how much amount the company is spending towards salaries.

Query

Output

Q5. Calculate the average salary of all employees.


Query

Output

Q6. Count the number of records in the Emp table.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q7. To calculate the number of employees in each dept.

Query

Output

Q8. Calculate the maximum, minimum salary for each department.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q9. Display the job where the number of employees is less than 3.

Query

Output

Q10.Display the department number & average salaries for those department whose
maximum salary greater than 10,000.

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Query

Output

Q11. Display the job_id & total monthly salary for each job with a total payroll exceeding
13000 & sort the result by total monthly salary & jobid does not contain MAN.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

LAB ASSIGNMENT - 6

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Assignment on Joins

Creating Table Dept

Q1. Display the employees-id,employee name,dept_id & department name for all the
employees.

Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

Q2. Display the employee smith department number & department name.
Query

Output

Q3. Display the employee last name, department name & city for each employee whose
salary is greater than 2000.

Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

Q4. Display the employee last name & department name for all employees who have ‘a’ in
their last name.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q5. Display the employee last name & employee number along with their manager last
name & manager number. The output should be in the following sequence
(employee_lastname,emp_id,manager_lastname,manager_id).
Query

Output

LAB ASSIGNMENT - 7

Assignment on Subqueries

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q1. Display the employees whose job-id is same as that of employee 102.

Query

Output

Q2. Display the employees whose job_id is same as that of employee 102 & whose salary is
greater than that of employee 144.

Query

Output

Q3. Display the information of all employees whose salary is equal to minimum salary.
Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

Q4. Display all the department minimum salary that have minimum salary greater than that
of department 20
Query

Output

Q5. Find the job with the lowest average salary.


Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q6. Display the employee number & ename of all employees who work in a department with
any employee whose last name contain letter u.
Query

Output

Q7. Display the last name & salary of every employee who reports to king.
Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q8. Display the name of employees who is getting the maximum salary.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q9. Display the employee number, last _name & salaries of all employees who work in a
department with any employee whose last name contain letter u & who earn more than the
average salary.

Query

Output

Q10. Display the employees who work in the same department as that of steven.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q11. Find the employee who earn least.

Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q12. Show the department no ,department name & the number of employees working in
each department : a) Includes employees less than 3 b) Has the highest number of
employees c) Has the lowest number of employees.

12.a Query

Output

12.b Query

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Output

12.c Query

Output

DBMS Lab
SADIK SAIFI 2101816 (13-B) BCA (IV sem)

Q13. Write a query to list the employees who earn more than their managers.
Query

Output

Q14. list the department number, department name & the number of employees.

Query

Output

DBMS Lab

You might also like