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

Assignment N1

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)
7 views

Assignment N1

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/ 5

Assignment 1 - IT207 - Fundamentals of Database System

Name: Date: _______________

Course and Section: _____________________________________

Objective: To practice basic SQL operations (SELECT, INSERT, UPDATE, DELETE) on a


simple employee database.

Instruction: Use Visual Studio. Make sure to show screenshots of evidence for each of the
items below.

Basic SQL Queries - 40 points


1. Creating Tables: 2 points each
○ Create a database named employee.
Answer:

○ Create a table named employee_info.


Column Name Data Type
employee_id INT (primary key, auto-increment)
first_name VARCHAR(50)
last_name VARCHAR(50)
department VARCHAR(50)
Salary DECIMAL(10,2)

Answer:

○ Insert 10 sample records into the employee_info table.


*Sample records in employee_id Column: 1,2,3,4,5…
*Sample records in department Column: Sales, HR, Marketing
Answer:
o Increase the salary of the employee with employee_id = 3 by 10%.
Answer:

o Change the department of the employee with employee_id = 5 to "Marketing".


Answer:

o Delete the employee with employee_id = 2.


Answer:
2. Selecting Data: 2 points each
○ Retrieve all employees from the "Sales" department.
Answer:

○ Retrieve only the first_name and last_name columns.


Answer:

○ Find the average salary of employees in the "HR" department.


Answer:

○ Sort the results by last_name in descending order.


Answer:
3. Aggregating Data: 5 points each
○ Calculate the average salary of employees.
Answer:

○ Find the maximum and minimum salaries.


Answer:

○ Count the number of employees in the "Sales" department.


Answer:

○ Group employees by department and calculate the average salary for each
department.
Answer:
Intermediate SQL Queries – 20 points

1. Subqueries: 10 points each


○ Find employees whose salary is higher than the average salary.
Answer:

○ Find the department with the highest average salary.


Answer:

You might also like