DFC 4024-Database Design: Problem Based Exercise 3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

DFC 4024-DATABASE DESIGN

NAME: DHEESHAGAN SEHKAR


CLASS: DIS3A
MATRIC NO: 32DIS16F2004
LECTURER`S NAME: CIK ZALINA BT MOHD SALLEH
ASSIGNMENT`S TITLE: PROBLEM BASED EXCERCISE 3

Problem Based Exercise 3 : Structured Query Language


(SQL)
Duration :2 Hours
Learning Outcomes (CLO3)

By the end of this laboratory session, you should be able to:

1. Understand and apply SQL Advanced commands


2. Understand and apply SQL Functions

Appendix
Database : CAR

CUSTOMER

custid custname Car_number Phone_number Register_date


P0001 David Lim WKM 1234 0139845263 12/06/14
P0002 Abu Hassan DBA 8999 0126377298 23/05/14
P0003 Low Ban Huat PFL 3434 0197894563 05/01/14
P0004 Karigalan BGN 2511 0112356897 23/05/13
P0007 Kamal Ibrahim WEP1103 0145689471 12/07/14

CAR_COMPONENT

compID compName price


KK001 ISWARA Rear Lamp 100
KK002 WIRA Front Bumper 450
KK003 ISWARA Front Mirror 500
KK004 WAJA Break Lamp 250
KK005 WIRA Front Lamp 350

CLAIM

claimID claim_date custid


CL001 02/06/14 P0002
CL002 10/07/14 P0001
CL003 24/07/13 P0004
CL004 05/08/14 P0002
CL012 07/07/14 P0003

COMPONENT_CLAIM

claimID compID quantity


CL001 KK002 1
CL001 KK005 2
CL003 KK001 2
CL012 KK003 1
CL004 KK001 2
CL002 KK003 1
CL003 KK003 1

EXCERSICE 3A : Able to understand and apply SQL Advanced commands

Procedures:

Step 1 : Open any Database software.

Step 2 : Create new blank database name CAR. (Refer Appendix)

Step 3 : Create table CUSTOMER, CAR_COMPONENT, CLAIM and


COMPONENT_CLAIM .

Step 4 : Insert attributes of each table.

Step 5 : Insert All the data into each table.


CUSTOMER

CAR COMPONENT
CLAIM

COMPONENT_CLAIM

Step 6 : Open the SQL Editor.

Step 7 : Type SQL command to find customer name from CLAIM table.

Step 8 : Open the SQL Editor.

Step 9 : Type SQL command to display component ID, component name and price where
price is between 200 and 400.
Step 10 : Open the SQL Editor and type SQL command to display car number begin with D.

Step 11 : Open the SQL Editor and type SQL command to display claim ID and quantity
where claim number is CL001 and CL012.

EXCERSICE 3B : Able to understand and apply SQL Functions.

(Refer Excersice 3A )

Procedures:

Step 1 : Open the SQL Editor and type SQL command to find the minimum value for price
in the COMPONENT table

Step 2 : Open the SQL Editor and type SQL command to find the maximum value for
price in the COMPONENT table
Step 3 : Open the SQL Editor and type SQL command to find the average value for price
in the table COMPONENT.

Step 4 : Type SQL command to find average value for quantity in the table
COMPONENT_CLAIM.

Step 5 : Open the SQL Editor and type SQL command to sum the price in the table
COMPONENT

Step 6 : Type SQL command to sum the components quantity in the table
COMPONENT_CLAIM.

Step 7 : Open the SQL Editor and type SQL command to count the number of
Customers

Step 8 : Type SQL command to count the rows in CLAIM table.


Step 9 : Open the SQL Editor and type SQL command to sum the quantity component
group by claim number.

Step 10 : Open the SQL Editor and type SQL command to find the total quantity group by
claimID which less than 1 in COMPONENT_CLAIM table.

You might also like