0% found this document useful (0 votes)
2 views

CSE370_Lab_Assignment02

This document outlines a lab assignment for a Database Systems course (CSE 370) in Spring 2025, focusing on creating and querying a database named 'Company_<Your8DigitStudentID>'. It specifies the structure of the Employee table, including attributes and their data types, and lists seven tasks requiring SQL queries to retrieve specific employee information based on various criteria. Students are instructed to insert test data into the table to facilitate the execution of these queries.

Uploaded by

sm.shafin.hassan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CSE370_Lab_Assignment02

This document outlines a lab assignment for a Database Systems course (CSE 370) in Spring 2025, focusing on creating and querying a database named 'Company_<Your8DigitStudentID>'. It specifies the structure of the Employee table, including attributes and their data types, and lists seven tasks requiring SQL queries to retrieve specific employee information based on various criteria. Students are instructed to insert test data into the table to facilitate the execution of these queries.

Uploaded by

sm.shafin.hassan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Department of Computer Science and Engineering

Course Code: CSE 370 Credits: 3.0

Course Name: Database Systems Semester: Spring 2025

Lab Assignment 2

Proving yourself worthy of being able to handle more significant tasks, the tech lead has decided to give
you a challenging job. However, this time, the data you would be handling is very sensitive and no one
wants this data to be leaked. Therefore, instead of getting the entire table, the tech lead has given you the
list of attributes that the table contains and the table name. The information given is as follows:

You will use a database called Company_<Your8DigitStudentID>.

Format: CREATE DATABASE Company_<Your8DigitStudentID>;​

CREATE DATABASE Company_12345678;

USE Company_12345678;

Table Name: Employee

Attribute Name Attribute type

employee_id char(10)

first_name varchar(20)

last_name varchar(20)

email varchar(60)

phone_number char(14)

hire_date date

job_id char(10)

salary int

commission_pct decimal(5,3)

manager_id char(10)

department_id char(10)
You need to insert rows (around 10 or more to test all of the queries for the following tasks) as per the
data types of the attributes/columns and problem statements of the following tasks.

Employee IDs should be ‘EMP001’, ‘EMP002’, etc.


Job IDs should be ‘JOB001’, ‘JOB002’, etc.
Manager IDs should be ‘MNG001’, ‘MNG002’, etc.
Department IDs should be DPT001, ..., DPT005, ... DPT007, etc.

Write down the queries to retrieve the following information:​ ​ ​ [7 X 2 =14]


1.​ Find the first_name, last_name, email, phone_number, hire_date and department_id of all the
employees with the latest hire_date.

2.​ Find the first_name, last_name, employee_id, phone_number, salary and department_id of all the
employees with the lowest salary in each department.

3.​ Find the first_name, last_name, employee_id, commission_pct and department_id of all the
employees in the department 'DPT007' who have a lower commission_pct than all of the
department 'DPT005' employees.

4.​ Find the department_id and total number of employees of each department which does not have a
single employee under it with a salary more than 30,000.

5.​ For each department, find the department_id, job_id and commission_pct with commission_pct
less than at least one other job_id in that department.

6.​ Find the manager_id who does not have any employee under them with a salary less than 3500.

7.​ Find the first_name, last_name, employee_id, email, salary, department_id and commission_pct
of the employee with the lowest commission_pct under each manager.

You might also like