Online Education Laboratory Exercise
Online Education Laboratory Exercise
Direction:
Copy and paste the PARTS table
Copy and paste the PL/SQL code on the space provided after each questions.
Table Name: PARTS
PARTNUM DESCRIPTION ONHAND CLASS WAREHOUSE PRICE
AT94 IRON 50 HW 3 2495
BVO6 HOME GYM 45 SG 2 79495
CD52 MICROWAVE OVEN 32 AP 1 165
DL71 CORDLESS DRILL 21 HW 3 12995
DR93 GAS RANGE 21 AP 2 495
DW11 WASHER 12 AP 3 399
FD21 STAND MIXER 22 HW 3 159
KL62 DRYER 12 AP 1 349
KT03 DISHWASHER 8 AP 3 595
KV29 TREADMILL 9 SG 2 1390
PARTS structure
COLUMN NAME DATA TYPE/SIZE KEY NULL
PARTNUM CHAR – 4 PRIMARY NOT NULL
DESCRIPTION VARCHAR – 20 NOT NULL
ONHAND NUMBER – 6
CLASS CHAR – 5
WAREHOUSE NUMBER – 6
PRICE NUMBER – 6
2. Create a report by eliminating the duplicate rows for column class and warehouse.
PARTNUM DESCRIPTION ONHAND CLASS WAREHOUSE PRICE
KL62 DRYER 12 AP 1 349
DR93 GAS RANGE 21 AP 2 495
KT03 DISHWASHER 8 AP 3 595
FD21 STAND 22 HW 3 159
MIXER
KV29 TREADMILL 9 SG 2 1390
3. Create a report specifying only the column PRICE, ONHAND and DESCRIPTION.
PRICE ONHAND DESCRIPTION
2495 50 IRON
79495 45 HOME GYM
165 32 MICROWAVE OVEN
12995 21 CORDLESS DRILL
495 21 GAS RANGE
399 12 WASHER
159 22 STAND MIXER
349 12 DRYER
4. Create a report that will add 10% increase in PRICE. List only the column DESCRIPTION, CLASS and
PRICE.
DESCRIPTION CLASS PRICE
IRON HW 2744.5
HOME GYM SG 87444.5
MICROWAVE OVEN AP 181.5
CORDLESS DRILL HW 14294.5
GAS RANGE AP 544.5
WASHER AP 438.9
STAND MIXER HW 174.9
DRYER AP 383.9
DISHHWASHER AP 654.5
TRTEADMILL SG 1529.0
5. Create a report that will deduct 5 from ONHAND, multiply 5 in WAREHOUSE, after getting the value
on both ONHAND and WAREHOUSE add their data: as shown below:
ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List only the
column DESCRIPTION, ONHAND and WAREHOUSE.
6. Create a report that will rename the column DESCRIPTION to TITLE, PARTNUM to ID and
ONHAND to STOCK.
ALTER TABLE parts RENAME COLUMN DESCRIPTION to TITLE;ALTER TABLE parts
RENAME COLUMN PARTNUM to ID;ALTER TABLE parts RENAME COLUMN ONHAND to
STOCK;select * from parts;
7. Create a report the will merge the column CLASS and PRICE rename the COLUMN as “CLASS
PRICE”.
8. Create a report that will combine the column PARTNUM and DESCRIPTION put a literal character
string “belongs to” in between the two columns then rename the column as “NUMBER TITLE”. Note
put space before and after the character literal string to avoid no spaces in the report.
9. Create a report that will display the unique value for WAREHOUSE rename the column as “No. of
Available Warehouse”.
10. What is the help of SELECT statement? Is there any permanent made in the database once the user uses
different SELECT.