Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Project file on Data Base with SQL

Submitted To:

Prestige institute
Of management.

Faculty guide: Submitted by:


Prof. Ram Kumar Paliwal Vivek Kumar Gupta
1. Create a database by using name dbEmployees

2. Create two tables (Depatments and Employees) by using the sql script
3. (Employee_create.sql) share with this exercise.

4. Insert data into above created tables by using the Sql script (Employee_insertdb.sql).
5. Once the above tables and data created check the data of both the tables.

6. Perform the below queries:


a. Select the last name of all employees
b. Select the last name of all employees, without duplicates.
c. Select all the data of employees whose last name is "Smith".
d. Select all the data of employees whose last name is "Smith" or "Doe".
e. Select all the data of employees that work in department 14.

f. Select all the data of employees that work in department 37 or department 77.
g. Select all the data of employees whose last name begins with an "S".
h. Select the sum of all the departments' budgets.
i. Select the number of employees in each department (you only need to show the

department code and the number of employees).


j. Select all the data of employees, including each employee's department's data.
k. Select the name and last name of each employee, along with the name and budget

of the employee's department.


l. Select the name and last name of employees working for departments with a budget

greater than $60,000.


m. Select the departments with a budget larger than the average budget of all the

departments.
n. Select the names of departments with more than two employees.
o. Select the name and last name of employees working for departments with second

lowest budget.
p. Add a new department called "Quality Assurance", with a budget of $40,000 and

departmental code 11. Add an employee called "Mary Moore" in that department,

with SSN 847-21-9811.


q. Reduce the budget of all departments by 10%.
r. Reassign all employees from the Research department (code 77) to the IT

department (code 14).


s. Delete from the table all employees in the IT department (code 14).
t. Delete from the table all employees who work in departments with a budget greater

than or equal to $60,000.


u. Delete from the table all employees.

You might also like