DML
DML
1. Run the statement in the lab8_1.sql script to build the MY_EMPLOYEE table that
will be used
for the lab.
2. Describe the structure of the MY_EMPLOYEE table to identify the column names.
DESCRIBE my_employee
3. Add the first row of data to the MY_EMPLOYEE table from the following sample
data. Do not list
the columns in the INSERT clause.
4. Populate the MY_EMPLOYEE table with the second row of sample data from the
preceding list.
This time, list the columns explicitly in the INSERT clause.
SELECT *
FROM my_employee;
ID LAST_NAME FIRST_NAME USERID SALARY
1 Patel Ralph rpatel 895
2 Dancs Betty bdancs 860
3 Biri Ben bbiri 1100
4 Newman Chad cnewman 750
5 Ropeburn Audrey aropebur 1550
6. Write an insert statement in a text file named loademp.sql to load rows into the
MY_EMPLOYEE table. Concatenate the first letter of the first name and the first
seven characters
of the last name to produce the userid.
7. Populate the table with the next two rows of sample data by running the insert
statement in the
script that you created.
SELECT *
FROM my_employee;
COMMIT;
11. Change the salary to 1000 for all employees with a salary less than 900.
UPDATE my_employee
SET salary = 1000
WHERE salary < 900;
DELETE
FROM my_employee
WHERE last_name = �Dancs�;
SELECT *
FROM my_employee;
15. Commit all pending changes.
COMMIT;
Control data transaction to the MY_EMPLOYEE table.
16. Populate the table with the last row of sample data by modifying the statements
in the script that
you created in step 6. Run the statements in the script.
SELECT *
FROM my_employee;
SAVEPOINT step_18;
DELETE
FROM my_employee;
20. Confirm that the table is empty.
SELECT *
FROM my_employee;
21. Discard the most recent DELETE operation without discarding the earlier INSERT
operation.
ROLLBACK TO step_18;
SELECT *
FROM my_employee;
COMMIT;