Professional Documents
Culture Documents
Lab Activity 5 1 PDF
Lab Activity 5 1 PDF
– Part 2
Duration:4 Hours
Learning Outcomes
This activity encompasses activities 5C and 5D.
SCENARIO
Miss Suria has been given the task of developing a database for a system of salary for the
company Millennium Cyber Sdn. Bhd. Miss Suria only has been given a month to complete
the task. Based on IT Manager of Infinity Design Solution Sdn Bhd, Miss Suria will be helped
by a practical student. Unfortunately, the student is not familiar with the concept of develop
database by using MySQL. Hence, Miss Suria need to implement workshop for students
related to the concept of SQL. These are some exercises the student will do to improve her
skills in SQL.
INSTRUCTION:
Answer the entire questions below.
Activity 5C
Activity Outcome: Able to understand and apply SQL Advanced commands
CUSTOMER
Step 1 : Create new blank database name CAR. (Refer Activity 5C)
Step 2 : Create table CUSTOMER, CAR_COMPONENT, CLAIM and COMPONENT_CLAIM
Step 3 : Insert attributes of each table.
Step 4 : Insert All the data into each table.
Step 5 : Type SQL command to find customer name from CLAIM table.
SELECT custname FROM CUSTOMER
WHERE custid IN (SELECT custid FROM CAR_CLAIM);
Step 6 : Type SQL command to display component ID, component name and price where
price is between 200 and 400.
SELECT compID, compName, price FROM COMPONENT
WHERE price BETWEEN 200 AND 400;
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.
SELECT AVG(price) AS AVGPRICE
FROM CAR_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
SELECT SUM(price) AS TOTALPRICE
FROM CAR_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
SELECT COUNT(custid) AS NumberOfCustomer
FROM CUSTOMER;
Step 10 : Open the SQL Editor and type SQL command to find the total
quantity group by claimID which less than 1 in