0% found this document useful (0 votes)
100 views4 pages

Week007 LogicalOperator LabExer004

This document provides instructions and a table for a laboratory exercise on writing SELECT statements in PL/SQL. Students are asked to write SELECT statements using the given PARTS table to retrieve specific fields based on 15 numbered questions. The PARTS table includes fields for part number, description, quantity on hand, class, warehouse, and price.

Uploaded by

Pie Pimentel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views4 pages

Week007 LogicalOperator LabExer004

This document provides instructions and a table for a laboratory exercise on writing SELECT statements in PL/SQL. Students are asked to write SELECT statements using the given PARTS table to retrieve specific fields based on 15 numbered questions. The PARTS table includes fields for part number, description, quantity on hand, class, warehouse, and price.

Uploaded by

Pie Pimentel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Course Code MIT005

Database Management System


Description
1
College / Department:
LabExer No. 004
Online Education
Laboratory Exercise Page 1 of 1

Direction:
 Use the Parts table in LabExer003 (previous week)
 This activity covers all SELECT statement discussed starting week 5-7.
 Based on the given table: PARTS as shown below, write the PL/SQL in order to get the printed output
per number. Write your answer in a short bond paper.
 Do not used IN condition.
 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.

SELECT PARTNUM||' '||DESCRIPTION AS "PART DESCRIPTION" , ONHAND||' '||CLASS


AS "ONHAND CL", WAREHOUSE, PRICE
FROM PARTS
ORDER BY PRICE ASC;
2.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE CLASS='HW';
3.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE DESCRIPTION LIKE '%R';
4.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE DESCRIPTION LIKE '%L';
5.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE DESCRIPTION LIKE '_A%';
6.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE DESCRIPTION LIKE 'D%'
ORDER BY ONHAND DESC;
7.

SELECT DISTINCT WAREHOUSE


FROM PARTS
ORDER BY WAREHOUSE;
8.

SELECT DISTINCT warehouse||' '||CLASS AS "WAREHOUSE CL"


FROM PARTS
where onhand between 9 and 32
and onhand <>22
order by description desc;
9.

SELECT PARTNUM||' BELONGS TO '|| DESCRIPTION AS "RECORD"


FROM PARTS
WHERE PARTNUM LIKE '_V%';
10.

SELECT DESCRIPTION, PRICE *.5+ PRICE-100


FROM PARTS
WHERE DESCRIPTION LIKE '_O%';
11.
SELECT DESCRIPTION, ONHAND + 10 AS "NEW ONHAND"
FROM PARTS
WHERE ONHAND RANGE 8 AND 12;
12.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE ONHAND=12 AND CLASS='AP';
13.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS
WHERE CLASS='AP'
AND ONHAND<>12;
14.

SELECT DESCRIPTION, ONHAND||' '||CLASS AS "ONHAND CL"


FROM PARTS;
15. What is the advantage of using Logical Condition?
Advantage of using logical Condition , we were able to test the truth of the condition. It is
giving as the value of TRUE, false or unknown.

Note. I just got confused if I need to write the answer to the paper, as the succeeding
instruction states to paste the answer after the table.

You might also like