Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Good evening looking for some help with the following Oracle SQL/PL questions: 1. Write a set of three SQL statements coded as a transaction to

Good evening looking for some help with the following Oracle SQL/PL questions:

1. Write a set of three SQL statements coded as a transaction to reflect the following change: United Parcel Service has been purchased by Federal Express Corporation and the new company is named FedUP. Rename one of the vendors and delete the other after updating the vendor_id column in the Invoices table.

2. Write a set of two SQL statements coded as a transaction to delete the row with an invoice ID of 114 from the Invoices table. To do this, you must first delete all line items for that invoice from the Invoice_Line_Items table.

3. Create a table named Timestamp_Values in the EX schema that contains four columns: timestamp_id as a NUMBER data type; timestamp_value as a TIMESTAMP(6) data type; timestamp_wltz_value as a TIMESTAMP WITH LOCAL TIME ZONE data type; and timestamp_wtz_value as a TIMESTAMP WITH TIME ZONE data type. Next, insert a row into this table with 1 for the id column, LOCALTIMESTAMP(3) for the second column, and CURRENT_TIMESTAMP(3) for the last two columns. Finally, write a SELECT statement that selects this data and review the data thats returned.

4. First, change the date format for the current session so it shows the time in 24-hour format. Second, write a SELECT statement that retrieves the four columns of the one row in the Timestamp_Values table that you created in exercise 1. Third, change the time zone for the session to MST. Fourth, insert a row just like the one you inserted in question 3 but with an id of 2. Fifth, run the SELECT statement again to review the differences in the two rows.

5. Keep the date format for the current session as described in question 3. Then, write a SELECT statement that retrieves four columns from the Timestamp_Values table of question 3 and 4: (1) timestamp_id, (2) timestamp_value, and (3) timestamp_value after it has been converted to Central Standard Time (CST) with cst_time as the column name.

6. Keep the date format for the current session as described in exercise 2. Then, write a SELECT statement that retrieves the invoice_number and invoice_date columns from the Invoices table in the AP schema, followed by a column named days_old that uses an interval function to retrieve the number of days, hours, and seconds that have elapsed between the invoice date and the current date. Sort the rows by the days_old value and only retrieve rows when the days_old value is greater than 30.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago