Академический Документы
Профессиональный Документы
Культура Документы
1. Run the lab9_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.
Name Null? Type
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.
RTA:
INSERT INTO my_employee (id, last_name, first_name,
2 userid, salario)
VALUES (2, 'Dancs', 'Betty', 'bdancs', 860);
2 Confirm your addition to the table.
RTA:
SELECT * FROM my_employee;
6. Create a script named loademp.sql to load rows into the MY_EMPLOYEE table
interactively. Prompt the user for the employee’s id, first name, last name, and salary.
Concatenate the first letter of the first name and the first seven characters of the last
name to produce the userid.
RTA:
INSERT INTO my_employee
VALUES (&p_id, '&p_last_name', '&p_first_name',
lower(substr('&p_first_name', 1, 1) || substr('&p_last_name', 1,
7)), &p_salario);
7. Populate the table with the next two rows of sample data by running the script that you
created.
RTA:
INSERT INTO my_employee
VALUES (& p_id, '& p_last_name', '& p_first_name',
lower (substr ('& p_first_name', 1, 1) ||
substr ('& p_last_name', 1, 7)), & p_salario);
RTA :
SELECT * FROM my_employee;
9. Make the data additions permanent.
RTA:
COMMIT;
RTA:
UPDATE my_employee
SET last_name = 'Drexler' WHERE id = 3;
Change the salary to 1000 for all employees with a salary less than 900.
RTA:
UPDATE my_employee SET salario = 1000 WHERE salario < 900;
11. Verify your changes to the table.
LAST_NAME SALARY
Patel 1000
Dancs 1000
Drexler 1100
Newman 1000
RTA:
SELECT last_name, salario
FROM my_employee;
RTA:
DELETE FROM my_employee
WHERE last_name = 'Dancs';
13. Confirm your changes to the table.
RTA:
SELECT ID, last_name FROM my_employee;
RTA : SELECT * FROM my_employee;
RTA:
COMMIT;
15. Populate the table with the last row of sample data by running the script that you created
in step 6.
RTA:
INSERT INTO my_employee
VALUES (&p_id, '&p_last_name', '&p_first_name',
lower(substr('&p_first_name', 1, 1) || substr('&p_last_name', 1,
7)), &p_salario);
RTA:
SAVEPOINT step_A;
RTA:
SELECT * FROM my_employee;
22. Make the data addition permanent.
RTA: COMMIT;