Week006-Where-LabExer003 Rivera Dennis
Week006-Where-LabExer003 Rivera Dennis
Direction:
Use the Parts table in LabExer003 (previous week)
Copy and paste the PL/SQL code on the space provided after each questions.
Table Name: PARTS
PARTNUM DESCRIPTION ONHAND CLAS WAREHOUSE PRICE
S
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 DATA KEY NULL
NAME TYPE/SIZE
PARTNUM CHAR – 4 PRIMARY NOT NULL
DESCRIPTION VARCHAR – 20 NOT NULL
ONHAND NUMBER – 6
CLASS CHAR – 5
WAREHOUSE NUMBER – 6
PRICE NUMBER – 6
1. Create a report listing only the column DESCRIPTION, PARTNUM, CLASS, and PRICE of all PART
whose CLASS is equal to HW.
2. Create a report listing only the column PARTNUM, DESCRIPTION and PRICE of all PARTS where
price is less than 500. Sort the PRICE in ascending order.
3. Create a report listing only the column DESCRIPTION, ONHAND and WAREHOUSE of all PARTS
where ONHAND is greater than or equal to 21.
4. Create a report listing only the column DESCRIPTION, CLASS and PRICE of all PARTS where class
is not equal to AP.
5. Create a report listing only the column CLASS, DESCRITPION and PRICE of all PARTS where price
range is between 200 to 500. Sort the Price in descending order.
6. Create a report listing only the column PARTNUM, CLASS and ONHAND of all parts where partnum
is equal to AT94, DR93 and KV29. (Note 1 query only and do not use logical condition)
7. Create a report listing only the column DESCRIPTION, ONHAND, CLASS and PRICE of all price
where the description ends with letter ‘N’.
8. Create a report listing only the column DESCRIPTION, WAREHOUSE, CLASS and PRICE of all parts
where the description contains keyword ‘SHE’.
9. Create a report listing only the column DESCIPTION, PARTNUM, CLASS and PRICE of all parts
where the description fourth letter starting from the first is equal to ‘D’.
10. Create a report showing all rows and columns sort the description in ascending order.
11. Create a report that will merge the column DESCRIPTION and PRICE put a literal character string of =
“ with a price of ” in between the two columns. Limit the rows returned by getting only the partnum that
starts with letter ‘K’.
12. Create a report that will display the distinct value for CLASS and WAREHOUSE limit the rows by
getting only the parts under WAREHOUSE 3.
13. Create a report by listing the column DESCRIPTION, WAREHOUSE and ONHAND. Get only the
warehouse value equal to 3 and the onhand value is equal to 21.
14. Create a report by listing the column PARTNO, DESCRIPTION and PRICE. Get only those Partnum
that either starts with letter ‘K’ or price that is less than 500. Sort your report by price in ascending
order.
15. Create a report by listing the column PARTNO, DESCRIPTION and WAREHOUSE. Get only that
description that does not ends with ‘ER’. Note that you have to merge the said three columns, rename
the merge column as “Parts Record”. Below is the sample output for column.
Parts Record
AT94 is the part number of IRON which belong to warehouse 3
16. Create a report by listing the DESCRIPTION and Price (Note that in column PRICE add ADDITIONAL
10000). Get only the prices with no digit that is equal to ‘5’. Note that you have to concatenate the said
column and rename the merge column as “New Price Lists”. Sort the data in DESC order by Price.
17. Write the different select clause following the order of precedence.
- Operator Precedence, Logical Operator Precedence,
18. What is the default order of sorting data in oracle? Write one example.
- Ascending. Example: A,B,C,D,E, etc….
19. When is LIKE condition properly used?
- LIKE is properly used in searching if you don’t know a correct string values on what you
search for.
20. When is IN condition properly used?
- IN condition is properly used in testing values in a list.