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

SQL Sheet

The document provides instructions for a series of SQL queries to perform operations on tables in a company database including inserting new records for employees and departments, updating employee records and department managers, and retrieving data by joining tables to display related information such as department details, project assignments, and employee salaries aggregated by department. The database schema includes tables for employees, departments, projects, and dependencies/supervisors.

Uploaded by

rowan essam
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)
43 views

SQL Sheet

The document provides instructions for a series of SQL queries to perform operations on tables in a company database including inserting new records for employees and departments, updating employee records and department managers, and retrieving data by joining tables to display related information such as department details, project assignments, and employee salaries aggregated by department. The database schema includes tables for employees, departments, projects, and dependencies/supervisors.

Uploaded by

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

Course title : Introduction to database

Course code : CS 202


Instructor : Dr. Yasser Foad

SQL Sheet
Company Database Schema

Database SQL : https://drive.google.com/file/d/1j0Ff60KjxwEaEKDi5R-


lucfx7PLmO0nC/view?usp=share_link
Employee
1- Insert a new employee with your personal data, you will be in department
number 30, your SSN = 666666&Superssn = 112233.

2- Insert the personal data of your friend as a new employee in department


number 30, SSN = 555555, but don’t enter any value for salary or
supervisor number to him.

3- In the department table insert new department called "DEPT IT”, with id=
100, MgrSSN = 112233 as a manager for this department. The start date
for this manager is '2006-08-12'

4- Do what is required if you know that : Mrs.Noha Mohamed moved to be


the manager of the new department (id = 100), and they gave her
position to your friend
Steps:
a. Your friend will be the manager of Dept 20 (her previous
department)
b. Update her record in your database to be a manager of
department 100.

5- Display the Department id, Department Name and its manager id and the
Manager name.

6- Display the project name and departments’ name that control them.

7- Display the dependent name for all the dependence and the name of the
employee they depend on him/her.

8- Retrieve the employee first name, project name of all employees work in
department 10 who works more than or equal 10 hours ordered by
first name.
9- For each department >>> display department name and number of its
employees -- if its average salary is less than 1200.

10- Retrieve a list of employees (fname) and the projects (project


name) they are working on ordered by department no, last name, first
name.

11- Find the project number, the controlling department name, the
department manager last name, address and birthdate. For each project
located in ‘Cairo’ City.

12- For each department, retrieve the department name and the
maximum, minimum and averagesalary of its employees.

You might also like