Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the Data Definition Language (DDL) statements and content of BOOKS table as follows. CREATE TABLE Books (ISBN VARCHAR2 (10) PRIMARY KEY, Title VARCHAR2

Given the Data Definition Language (DDL) statements and content of BOOKS table as follows. CREATE TABLE Books a) Complete the following stored function called NEW RETAIL to return the new retail price by accepting two b) Use the function in a SELECT statement against the BOOKS table for all books. Display the ISBN, book

Given the Data Definition Language (DDL) statements and content of BOOKS table as follows. CREATE TABLE Books (ISBN VARCHAR2 (10) PRIMARY KEY, Title VARCHAR2 (30), PubDate DATE, PubID NUMBER (2), Cost NUMBER (5,2), Retail NUMBER (5,2), Category VARCHAR2 (12)); ISBN TITLE BODYBUILD IN 10 MINUTES 1059831198 A DAY 401140733 REVENGE OF MICKEY BUILDING A CAR WITH 4981341710 TOOTHPICKS DATABASE 8843172113 IMPLEMENTATION COOKING WITH 3437212490 MUSHROOMS 3957136468 HOLY GRAIL OF ORACLE 1915762492 HANDCRANKED COMPUTERS 9959789321 E-BUSINESS THE EASY WAY 2491748320 PAINLESS CHILD-REARING 299282519 THE WOK WAY TO COOK 8117949391 BIG BEAR AND LITTLE DOVE 132149871 HOW TO GET FASTER PIZZA HOW TO MANAGE THE 9247381001 MANAGER 2147428890 SHORTEST POEMS PUBDATE PUBID 4 01/21/2001 12/14/2001 03/18/2002 6/4/2099 02/28/2000 12/31/2001 01/21/2001 3/1/2002 07/17/2000 9/11/2000 11/8/2001 11/11/2002 5/9/2099 5/1/2001 1 2 3 4 3 3 2 5 4 5 4 1 5 COST RETAIL CATEGORY 18.75 14.2 37.8 31.4 12.5 47.25 21.8 37.9 48 19 5.32 17.85 15.4 21.85 30.95 FITNESS FAMILY 22 LIFE 59.95 CHILDREN 55.95 COMPUTER 19.95 COOKING 75.95 COMPUTER 25 COMPUTER 54.5 COMPUTER FAMILY 89.95 LIFE 28.75 COOKING 8.95 CHILDREN 29.95 SELF HELP 31.95 BUSINESS 39.95 LITERATURE a) Complete the following stored function called NEW RETAIL to return the new retail price by accepting two parameters (category and retail). The percentage of price increase is according to the category. Use the following table to help you. IS Category FITNESS FAMILY LIFE CHILDREN COOKING COMPUTER OTHERS The NEW RETAIL function: CREATE OR REPLACE FUNCTION new_retail BEGIN Percentage 8% 8% 3% 7% 10% 5% add your code here. v_newretail books.retail&TYPE; add your code here. RETURN v newretail; END new_retail; / b) Use the function in a SELECT statement against the BOOKS table for all books. Display the ISBN, book title, retail price and the new retail price. The example output is given in the following figure. ISBN 1059831198 0401140733 4981341710 8843172113 3437212490 3957136468 1915762492 TITLE BODYBUILD IN 10 MINUTES A DAY REVENGE OF MICKEY BUILDING A CAR WITH TOOTHPICKS DATABASE IMPLEMENTATION COOKING WITH MUSHROOMS HOLY GRAIL OF ORACLE HANDCRANKED COMPUTERS 30.95 22 RETAIL 5995 55.95 1995 75.95 25 33.43 231 New Retail 61.75 61.55 21.35 83.55 27.5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

B Solution CREATE OR REPLACE FUNCTION FINDNEWRETA... 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_2

Step: 3

blur-text-image_3

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions