You are on page 1of 2

College of Engineering and Information Technology

Database for Management (INT 300)

2nd semester 2021/2022


Lab # 2

1. Given the following two tables

Department

Column Name Type Key Required

Department_Code Number(2) Primary key

Department_name Varchar2 (14) Not null

Dept_Location Varchar2 (30)

Manager_ID Number(10)

Department_Budget Number(14,2)

Employee
Column Name Type Key
Employee_Id Number(10) Primary key
First_Name Varchar2 (20) Not null
Last_Name Varchar2 (20) Not Null
Email Varchar2 (40)
Phone_Number Varchar2 (20)
Hire_Date Date
Salary Number(14,2)
Department_Code Number (2) Foreign key that
references

1
department_Code of the
Departments table
Gender Char(1)

1. Write an SQL statement to create the above two tables.

2. Write an SQL statement to insert the following data into the Department table

Department_Id Department_Name Dept_Location Manager_ID Department_Budget


10 Research Ajman 300 150000.5
20 Administration Dubai 400 200000
30 Headquarter AbuDhabi 200 700000

3. Write an SQL statement to insert the following data into the Employee table

Employee_I First_Name Last_Name Email Phone_Number Hire_Date Salary Department_id Gender


d
400 Salim Ali a@yahoo.com 05066 10-12-2000 20000 10 M
500 Mahir Subhi b@hotmail 05078866 01-01-2010 12000 30 M
700 Fatema Matar c@ajman 050666777 01-09-2003 60000 30 F

4. Write an SQL statement to delete from employee table the row which has employee_id = 700

5. Write an SQL statement to add a column named Address to the employee table which has a
type varchar2 and size 30.

6. Write an SQL statement to remove the column Phone_Number from the employee table.

7. Write an SQL statement to rename the employee table to emp_details

8. Write an SQL statement to drop the emp_details table.

You might also like