0% found this document useful (0 votes)
25 views3 pages

Assignment 2-B

The document provides instructions for a database systems lab assignment. Students are asked to create tables, write SQL queries to retrieve and modify data, and calculate aggregates. The assignment requires setting up a database, writing queries for basic and advanced tasks, and submitting the SQL scripts and results.

Uploaded by

I am ab Yes
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)
25 views3 pages

Assignment 2-B

The document provides instructions for a database systems lab assignment. Students are asked to create tables, write SQL queries to retrieve and modify data, and calculate aggregates. The assignment requires setting up a database, writing queries for basic and advanced tasks, and submitting the SQL scripts and results.

Uploaded by

I am ab Yes
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/ 3

COMSATS University Islamabad (Lahore Campus)

Lab Assignment 2 FALL 2023


Course Title: Database Systems I Course Code: CSC371 Credit Hours: (3+1)
Course Instructor: Khaqan zaheer Programme Name: BS Software Engineering
Due Date: 20-10-23 Maximum Marks: 20
Important Instructions / Guidelines:

Instructions:
1. You will need access to a database system (e.g., MySQL, PostgreSQL, SQLite) to complete these
assignments.

2. Create a new database called "Company" for these exercises.

3. Use the following tables for your assignments:

Table 1: Employees
- Attributes: EmployeeID (Primary Key), FirstName, LastName, Department, Position, Salary

Table 2: Projects
- Attributes: ProjectID (Primary Key), ProjectName, StartDate, EndDate

Table 3: Assignments
- Attributes: AssignmentID (Primary Key), EmployeeID (Foreign Key references Employees), ProjectID
(Foreign Key references Projects), HoursWorked

Lab Assignment Questions:

Question 1: Database Setup

Create the necessary tables (Employees, Projects, Assignments) with appropriate data types and
constraints in the "Company" database. Ensure that primary and foreign keys are defined correctly.

Question 2: Basic SQL Queries


Write SQL queries for the following tasks:
2.1. Retrieve the first and last names of all employees.

2.2. List the project names and their corresponding start dates.

2.3. Find the total number of employees in the "Sales" department.

2.4. Retrieve the project names and the total hours worked on each project.

Question 3: Data Modification


Write SQL statements for the following tasks:

3.1. Update the salary of the employee with EmployeeID = 101 to $60,000.

3.2. Delete the assignment record with AssignmentID = 201.

Question 4: Advanced SQL Queries


Write SQL queries for the following tasks:

4.1. Find the top 3 employees with the highest salaries.

4.2. List all employees and their positions, but alias the "Position" column as "JobTitle."

4.3. Retrieve the project with the maximum total hours worked.

4.4. Calculate the average salary of employees in the "Engineering" department.

Submission:
- Create a script containing your SQL queries and commands for each question.

- Provide the output of each query/command where applicable.

- Submit your script and the results as a single document.

Grading:
Your lab assignment will be graded based on the correctness of SQL statements, adherence to
instructions, and the accuracy of the results produced by your queries. Additionally, the database
setup in Question 1 will be evaluated for correctness and adherence to good database design
principles

Deadline: Please submit your completed assignment by [20-10-2023] to your CR email and
then CR will zip and email me at address ([email protected]).

Good luck and happy coding


.

You might also like