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

Log on to ApEx and go to the Object Browser under the SQL Workshop menu. Look fo

ID: 3796066 • Letter: L

Question

Log on to ApEx and go to the Object Browser under the SQL Workshop menu. Look for the DEMO_PRODUCT_INFO table. Write down all of the column names for the table.

1. Navigate to the SQL command window and create a SQL query that will give the product ID, product description and product list price from the DEMO_PRODUCT_INFO table. Use the TO_CHAR function with the dollar/currency format to display the price in American dollars and cents.

In your submission include the SQL code and a screen shot of the result set.

2. Modify the previous SQL query so that it displays the date three months from now. To make this query as flexible as possible use SYSDATE with the LAST_DAY() function to get the last day of this month (’7-FEB-2017’ in this particular case), along with the ADD_MONTHS() function to display the date three months from now. The purpose of this SELECT statement is to show how long the given price of the product will be in effect, so add a column alias to the date column saying “Price good until.”

In your submission include the SQL code and a screen shot of the result set.

3. Write a SQL query that will give the employee number, employee name and hired date from the EMP table. Use the TO_CHAR function along with the format mask ‘DDMMYYY’ to display the hired date.

In your submission include the SQL code and a screen shot of the result set.

4. Write a query that will select the ORDER_ID, CUSTOMER_ID and ORDER_TIMESTAMP columns from the demo_orders table. Use the to_char() function to display the date data from the ORDER_TIMESTAMP column in a format that has the day as two numbers, the month as the first three characters of the name of the month, the full year as numbers, the hour and the minute.

In your submission include the SQL code and a screen shot of the result set.

Submit your assignment to the Problem Set 4 Drop Box.

Explanation / Answer

CREATE TABLE "OWNER"."DEMO_ORDERS"
( "ORDER_ID" NUMBER NOT NULL ENABLE,
"CUSTOMER_ID" NUMBER NOT NULL ENABLE,
"ORDER_TOTAL" NUMBER(8,2),
"ORDER_TIMESTAMP" DATE,
"USER_ID" NUMBER,
CONSTRAINT "DEMO_ORDER_TOTAL_MIN" CHECK (order_total >= 0) ENABLE,
CONSTRAINT "DEMO_ORDER_PK" PRIMARY KEY ("ORDER_ID")
USING INDEX PCTFREE 10 INITRANS 4 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1028476 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "DEMO_ORDERS_CUSTOMER_ID_FK" FOREIGN KEY ("CUSTOMER_ID")
REFERENCES "OWNER"."DEMO_CUSTOMERS" ("CUSTOMER_ID") ENABLE,
CONSTRAINT "DEMO_ORDERS_USER_ID_FK" FOREIGN KEY ("USER_ID")
REFERENCES "OWNER"."DEMO_USERS" ("USER_ID") ENABLE
) PCTFREE 20 PCTUSED 60 INITRANS 1 MAXTRANS 555 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote