Week004-DML-LabExer001 Rivera Dennis
Week004-DML-LabExer001 Rivera Dennis
Week004-DML-LabExer001 Rivera Dennis
Direction: Copy and paste the PL/SQL code on the space provided after each
questions ad explain each number with question that requires you to answer in essay
form.
1. Create a table name as: EMPLOYEE_RECORD with the following column as shown below:
ID FIRSTNAME LASTNAME EMAIL JOB_ID SALARY DEPT_ID
Number(6) Varchar(10) Varchar(10) Varchar(15) Varchar15 Number(6) Number(6)
PK NOT NULL
3. Add new column name as ADDRESS data type char size 20.
4. After you add a new column address view now the table? What happen to the addresses of all old
employees? Explain the reason why?
Null, Because it was empty and no details added.
5. Add new record as shown below:
10 JULY SORIANO MSORIANO TEACHER 2600 80 BRGY.PAMBUAN GAPAN
5
Is inserting a new record in No.5 is possible? Why and why not? Explain the reason why?
Yes, Because the details are the same from the previous record and having 7 columns.
Is inserting a new record in No.6 is possible? Why and why not? Explain the reason why?
No, It is not possible there is an error because of duplicating the primary key.
Is inserting a new record in No. 8 is possible? If not perform some modification on table structure in
order to insert the record of Ms. Valencia.
No, Because the VARCHAR limitation is only 20. It must update the VARCHAR to 34. Check
the output below.
Note: For succeeding activity: make sure to view you table and study its content.
8. All employees that having a salary of 5800 should be assigned in one dept_id 90, update their
departments to 90.
9. Trina got married, after her leave Ms. Trina ask you to update her record in the database from RAJS to
DE LEON.
10. After serving the company for three year Randal got promoted as the newest ad_pres and with a new
salary of 250000. Update his record using one SQL only.
11. Since Mr. Randal replace the position of Mr. Steven, delete the record of Mr. Steven since he is no
longer connected to the company.
12. All employees are given an additional 2% increase in their salaries. Create an SQL statement that would
change the employees’ salaries with additional 10%. Note: Use rows with the same values in order to
limit the number of query to be use.
Not yet discussed in the lecture. Mam can I do this after the discussion on how to add the
increment please . I am sorry Mam Mary.
13. Email address is not being use, and save space you have to delete the said column.
14. Select the table now and draw the final output after you perform the DDL and DML statements.
15. What will happen if the accidentally type DELETE * FROM EMPLOYEES without issuing WHERE
condition?
Error, If I add (*) but if I removed the (*) all rows are deleted.