0% found this document useful (0 votes)
53 views

It6202 Lab - 004

This document provides directions for a laboratory exercise involving writing SQL queries on a PARTS database table. It includes the structure of the PARTS table with sample data and 14 questions asking to write SQL queries meeting certain criteria. The questions involve using SELECT statements with WHERE clauses containing logical conditions like equals, LIKE, AND, OR and DISTINCT to retrieve specific fields or calculate new values. The last question asks about the advantage of using logical conditions in searches.

Uploaded by

Anime Lover
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)
53 views

It6202 Lab - 004

This document provides directions for a laboratory exercise involving writing SQL queries on a PARTS database table. It includes the structure of the PARTS table with sample data and 14 questions asking to write SQL queries meeting certain criteria. The questions involve using SELECT statements with WHERE clauses containing logical conditions like equals, LIKE, AND, OR and DISTINCT to retrieve specific fields or calculate new values. The last question asks about the advantage of using logical conditions in searches.

Uploaded by

Anime Lover
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 Type Course Code Here

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. SQL>SELECT * FROM PARTS;

2. SQL>SELECT DESCRIPTION. ONHAND, CLASS FROM PARTS WHERE CLASS =’HW’;

3. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE DESCRIPTION


LIKE ‘%ER’;

4. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE DESCRIPTION


LIKE ‘%ILL’;

5. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE DESCRIPTION


LIKE ‘_AS%’ AND CLASS = ‘AP’;

6. SQL>SELECT DISTINCT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE


DESCRIPTION LIKE ‘%ER’ AND CLASS = ‘AP’;

7. SQL>SELECT DISTINCT WAREHOUSE FORM PARTS;


8. SQL>SELECT DISTINCT WAREHOUSE, CLASS FROM PARTS;

9. SQL>SELECT PARTNUM || ' belongs to ' || DESCRIPTION AS "RECORD" FROM PARTS


WHERE CLASS = 'SG';

10. SQL>SELECT DESCRIPTION, PRICE*.5 +PRICE-100 FROM PARTS WHERE PRICE >
‘10000’;

11. SQL>SELECT DESCRIPTION, ONHAND, ONHAND+10 AS “NEW RECORD” FROM


PARTS WHERE ONHAND < ’13’;

12. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE DESCRIPTION


LIKE ‘%ER’ AND ONHAND = ‘12’;

13. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS WHERE PRICE ‘%5’
AND CLASS = ‘AP’;

14. SQL>SELECT DESCRIPTION, ONHAND, CLASS FROM PARTS;


15. What is the advantage of using Logical Condition?

Including logical conditions into our search procedure enables us to produce a report that is
substantially more focused and precisely identifies the particular objects or data points we are
looking for, which eventually results in a more effective and efficient workflow. This is so that, in
the long term, we can save time and resources by being able to filter out information that isn't
important to our task or purpose and focus on the essential components.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy