Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Run the following script to build the MY_EMPLOYEE table for the assignment. SET

ID: 3910006 • Letter: R

Question

Run the following script to build the MY_EMPLOYEE table for the assignment.

SET ECHO OFF
SET FEEDBACK OFF
PROMPT Creating the MY_EMPLOYEE table. Please wait...
CREATE TABLE my_employee
(id NUMBER(4)
CONSTRAINT my_employee_id_nn NOT NULL,
last_name VARCHAR2(25),
first_name VARCHAR2(25),
userid VARCHAR2(8),
salary NUMBER(9,2))
/
PROMPT Table MY_EMPLOYEE has been created.
SET FEEDBACK ON
SET ECHO ON

Answer the following questions:

--Describe the structure of the MY_EMPLOYEE table to identify the column names.Add the following row of data to the MY_EMPLOYEE table without listing the columns in the INSERT clause:
LAST_NAME FISRT_NAME USERID SALARY

Patel Ralph rpatel 795

--Add the following row of data to the MY_EMPLOYEE table listing the columns in the INSERT clause:LAST_NAME FISRT_NAME USERID SALARY

Dancs Betty bdancs 860

--Confirm your additions to the table.

--Create a SQL statement that prompts 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.

--Add the following rows of data to the MY_EMPLOYEE table:LAST_NAME FISRT_NAME USERID SALARY

Biri Ben bbiri 1100

Newman Chad cnewman 750

--Confirm your additions to the table.

--Make the data additions permanent.

--Change the name of employee 3 (Biri) to Drexler.

--Change the salary to 1000 for all employees with a salary less than 900.

--Verify your changes to the table.

--Delete Betty Dancs from the MY_EMPLOYEE table.

--Make all changes permanent.

--Add the following row of data to the MY_EMPLOYEE table:

LAST_NAME FISRT_NAME USERID SALARY

Ropeburn Audry aropebur 1550

--Mark an intermediate point in the process of the transaction.

--Empty the entire table.

--Confirm the table is empty.

--Discard the DELETE operation.

--Make the data addition permanent.

Explanation / Answer

1) describe my_employee;

insert into my_employee values('Patel','Ralph','rpatel',795);

2)insert into my_employee(LAST_NAME,FIRST_NAME,USERID,SALARY) values('Dancs','Betty','bdancs',860);

3)select id,firstname,lastname,salary,concat(substring(FIRST_NAME,1,1),substring(last_name,1,7)) as userid from my_employee;

4)insert into my_employee(LAST_NAME,FIRST_NAME,USERID,SALARY) values('Biri','Ben','bbiri',1100),('Newman','Chad','cnewman',750);

5)select * from my_employee;

6)update my_employee
set first_name='drexler'
where id=3;

7)update my_employee
set salary=1000
where salary<900;


8)delete from my_employee
where first_name='betty' and last_name='Dancs';

9)insert into my_employee(LAST_NAME,FIRST_NAME,USERID,SALARY)
VALUES('Ropeburn','Audry','aropebur',1550);