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

ORACLE SQL (1) Write and run an ALTER TABLE command to add a column that is of t

ID: 3607168 • Letter: O

Question

ORACLE SQL

(1) Write and run an ALTER TABLE command to add
a column that is of the TIMESTAMP data type to the hold_02
table in your schema. Name the new column the hold_date_ts.
(2) Write and run commands to retrieve the data from the altered
table, and to update a record by adding in a timestamp type
value into the new column that is 5 hours 5 minutes and 5.55
seconds later than the date and time value in the hold_date
column of the row you are updating. To do this, just
manually calculate the new value to be inserted and use
TO_TIMESTAMP to convert the string representation to
TIMESTAMP type for insertion. Note* You may have to
look forward in the Murach book to find information about
the TO_TMESTAMP function to help you accomplish this task.
Also note that if you choose an existing record with the
time value of midnight, the arithmetic is not difficult.
Also write a command to retrieve the row with the updated
data. (3) Now write and run an ALTER TABLE command to add
a column that is of the TIMESTAMP WITH TIMEZONE data type,
also adding the column to the hold_02 table. Name the new
column expire_date_tz. (4) Write and run commands to
retrieve the data you changed in step 3 from the altered
table, and to update the same record by adding in a
timestamp with timezone type value into expire_date_tz
that is 7 hours 7 minutes and 7.77 seconds later than the
date and time value expire_date column of the row you
are updating and that is in a different time zone. Use
functions demonstrated in Murach Chapter 17 to help you as
needed, but use manual addition to predetermine the string
value that represents the timestamp value you want to insert.
Also write a command to retrieve the row with the updated
data.*

Hold_02 table consists of:

This is all one question. Apologies. Please provide syntax

COLUMN NAME HOLD ID TOOL_NO TOOL DESC ID EMPLOYEE ID JOB ID HOLD DATE EXPIRE DATE HOLD ACTIVE HOLD STATUS CHANGE DATE DATE DATA TYPE NUMBER (8,0) NUMBER (8,0) NUMBER (8,0) NUMBER (8,0) NUMBER (8,0) DATE DATE VARCHAR2 (8 BYTE) NULLABLE DATA DEFAULT COLUMN IDCOMMENTS No No No No Yes No Yes No No (null) (null) (null) (null) (null) (null) (null) (null) (null) 1 (null) 2 (null) 3 (null) 4 (null) 5 (null) 6 (null) 7 (null) 8 (null) 9 (null)

Explanation / Answer


1)ALTER TABLE Hold_02
ADD COLUMN hold_date_ts TIMESTAMP(6);

2)SELECT * FROM Hold_02;

update Hold_02
set hold_date_ts=(TO_TIMESTAMP('2017-11-02 05:05:5.55','YYYY-MM-DD HH24:MI:SS.FF'));


3)ALTER TABLE Hold_02
ADD COLUMN expire_date_tz TIMESTAMP(6) WITH TIME ZONE;