Professional Documents
Culture Documents
It6202 Lab - 001
It6202 Lab - 001
It6202 Lab - 001
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.
ALTER TABLE EMPLOYEE_RECORD ADD ADDRESS VARCHAR (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?
The appearance of the address column in the table has caused some concern, as it has been
observed that the address information for a number of former employees is missing. This is due to a lack
of data input during the encoding process, which resulted in the omission of this important information
for those specific individuals. The absence of this information for the former employees raises questions
about the thoroughness of the data input process and the reliability of the information contained within
the table.
Is inserting a new record in No.5 is possible? Why and why not? Explain the reason why?
The ability to insert a new record with number 5 is feasible because the identification number for
record number 5 is distinct from those of previous employees who have already been encoded into the
system. This uniqueness of the ID for record number 5 eliminates any potential conflicts with the
existing employee information that has already been entered and stored within the database. As a result,
the addition of this new record will not cause any disruptions to the current organization of the employee
information.
It would not be feasible to insert this new record into the table due to a potential conflict that
could arise with the ID numbers assigned to row no. 5 and row no. 6. These two rows in the table
have the same ID, and adding a new input with a similar ID would create confusion and make it
impossible to properly process the information. This situation requires a unique and distinguishable
ID for each record in the table, otherwise it would be difficult to properly manage and organize the
data.
7. Add again a new record as shown below:
106 RAYCHELO VALENCIA RVALENCIA DEAN 5000 80 CANIOGAN ST. DR.
U 0 SIXTO BLDG. PASIG
INSERT INTO EMPLOYEE_RECORD VALUES
(106,'RAYCHELOU','VALENCIA','RVALENCIA','DEAN','50000','80','CANIOGAN ST.DR
SIXTO BLDG. PASIG');
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.
It is not possible to insert the new record no.8 because the content of the address exceeded to
the limited value of the column there for the content of no.8 would be rejected. The modification that
can be done in order for the database to accept this content is to reduce the amount of the address
like removing the “Caniogan St.” so that system can accept the content of Ms. Valencia.
8. All employees that having a salary of 5800 should be assigned in one dept_id 90, update their
departments to 90.
1 row updated.
1 row updated.
1 row updated.
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.
11 rows updated.
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.
11 rows selected.
15. What will happen if the accidentally type DELETE * FROM EMPLOYEES without issuing WHERE
condition?
If the name of the table associated with this sentence were entered incorrectly, it would not have
any negative effects on the database because it is associated with the correct table; however, if the name
of the table were entered correctly by chance, the entire contents of that table would be permanently
deleted, leaving only the name of the table as the only item still present in the database.