Water Refilling System PDF
Water Refilling System PDF
A Database Design
In Partial Fulfillment
GLADYS T. ELIVER
March 2019
1
TABLE OF CONTENTS
Title Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .i
System Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
2
SYSTEM DESCRIPTION
One of the fastest and expanding businesses today is water refilling station. Water
refilling station is small water system that has its own water purification facility producing a
portable drinking water. The aqua water refilling system has their own water tank and
equipment that intend on their business.
So, we design a system in this kind of business in order to be on top and align on the
fast-growing business that is demand now a day.
This system will be programmed to java that can enable the user to record things that
are being purchased by the clients and it be created using MySQL database.
This system manages to display the data to be filled by the user according to the
information of the customer in organize manner, such that their personal details, and the
services they want to avail as well as the payment on the transaction they purchased. The
system keeps the information of the customer and the details of what they purchased.
The system coordinates the arrangement on delivery of products. It consists all the
records for the location of the clients, date of transaction, schedule of delivery, contact number
and the person assign to deliver and the payment of customer to the quantity of product that
about to deliver.
The system also views the information about the availability of the products as well as
the containers. The system views the available containers to provide stocks again.
This system also manages the information of the employees that a refilling station must
have just like front liner, cashier, technical assistant, and delivery an. It stores the information in
organize so that it easy to the owner to access on the detail of his/her employee.
Upon having this system, it will provide the capacity to the owner and clients to transact
without spending time and effort.
Basic features:
3
ENTITY RELATIONSHIP DIAGRAM
Figure 1 Proposed water refilling management system Entity Relationship Diagram shows the
system entity relationship in each entity and their supposed function in each relationship.
Based on figure 1, the proposed aqua water refilling management system entity relationship
diagram are the entity of the proposed water refilling management system database, which are
represented by tables, the tables are made to meet the required specification of the system and
provide a much specific details of the each entities within the system.
4
DATA DICTIONARIES
The table below provide the entire database tables details such as field names, descriptions,
data type and character length.
TABLE 1. EMPLOYEE
Table 2. Customer
5
TABLE 3. PRODUCT
TABLE 4. DELIVERY
TABLE5.CONTAINERS
6
TABLE 6.PAYMENT
TABLE 7.TRANSACTION
7
SELECT STATEMENT USING DIFFERENT FUNCTIONS
15 Result(s) found.
3 result(s) found.
3. Show all the total number of each container.
a. Solution
SELECT sum(quantity) as "Total number of all
container",CONTAINER_NAME FROM ` containers` GROUP by
CONTAINER_NAME;
b. Result
3 result(s) found.
4. Create a query that display the sum of the ALKALINE products.
a. Solution
SELECT SUM(QUANTITY) "total product",Product_name"PRODUCT NAME"
FROM product WHERE Product_name='ALKALINE' ;
b. Result
1 result(s) found
5. Show all the list of customer who transact in the month February 28.
a. Solution
8
SELECT L_NAME "customer Last names", length (l_name)" last names
length" FROM customer;
b. Result
6 result(s) received
1 result(s) received
7. Write a query that display the list of customer transaction details that have balance
more than 100.
a. Solution
SELECT transaction_id "transaction id",PRODUCT_ID"product
id",QUANTITY,TRANS_TYPE"transaction type",UNIT_PRICE"unit
price",TOTAL FROM `transaction` WHERE TOTAL > 100;
b. Result
7 result(s) received
8. For each transaction display the transaction type and calculate the total number of
customer choose the transaction.
a. Solution
SELECT TRANS_TYPE "transaction type", count(TRANS_TYPE)" total of
customer " FROM `transaction`GROUP by TRANS_TYPE;
9
b. Result
2 result(s) found
12 result(s) found
10. Display each transaction type, date of transaction, and date of the week on which the
transaction done. Label the column DAY. Order the results by the day of the week.
a. Solution
SELECT TRANSACTION_ID"transaction number",TRANS_TYPE"transaction
type",`DATE`"date of transaction",dayname(date)"Day" FROM transaction
ORDER by weekday(date);
b. Result
8 result(s) found
11. Write a query that display product name in lowercase and total number of each
product.
a. Solution
SELECT lower(Product_name)"product
name",COUNT(Product_name)"number of products" FROM `product`GROUP
by Product_name;
b. Result
1 result(s) received
10
12. Write a query that display the total number of transaction.
a. Solution
SELECT count(*)"total number of transaction" FROM `transaction`;
b. Result
1 result(s) found.
13. Create a query that display the date and amount received.
a. Solution
SELECT AMOUNT_RECEIVED"amount received",DATE FROM `payment`;
b. Result
15 result(s) found.
14. Show all employee full names and contact numbers.
a. Solution
SELECT concat(F_NAME,' ',LAST_NAME)" employee full
name",CONTACT_NUM FROM employee;
b. Result
3 result(s) found.
15. Show the maximum products.
a. Solution
SELECT avg(quantity) " average of container availability" FROM product;
b. Result
1 result(s) found.
16. For each transaction, display the transaction number,product id, unit price, and
total amount to be paid discounted by 1% and expressed as a whole number.
a. Solution
SELECT transaction_ID as "transaction Number",PRODUCT_ID"product
number", UNIT_PRICE"unit price",total,total- ROUND(total*.1, 0) AS "total
discounted by 1%" FROM `transaction`;
b. Result
11
12 result(s) found.
17. Create a query that display the average of amount tender by the customer.
a. Solution
SELECT avg(amount_received) " average of amount received " FROM
payment;
b. Result
1 result(s) found.
18. Write a query that display the customer last names starting with M, R, T, and it’s
length.
a. Solution
SELECT upper(L_NAME) AS "customer last name",LENGTH (L_NAME)
"LENGTH OF NAME" FROM customer WHERE (L_NAME) LIKE 'r%' OR
L_NAME LIKE 't%'OR L_NAME LIKE 'M%' ORDER BY L_NAME;
b. Result
6 result(s) found.
19. Display customer last name, first name and date of transaction who transact January
01, 2019 up to March 28, 2019.
a. Solution:
SELECT L_NAME as "Last Name", F_NAME as " First Name", DATE as " transact
Date" FROM `customer` WHERE DATE BETWEEN '2019-01-12'AND'2019-03-
28';
b. Result
12
21 result(s) found
a. Solution
SELECT sum(AMOUNT_RECEIVED)" total amount received"FROM
`payment`;
b. Result
1 result(s) found
13
Select Statements using Sub Query
1. Write a query that display the product name, price and the product that has many
number of availabilty .
a. Solution
SELECT Product_name "Product name",Unit_price"unit price" FROM product
WHERE Product_name in (SELECT max(Product_name) FROM
product)GROUP by Product_name;
b. Result
1 result(s) found.
2. Write a query that display the customer last name, first name who lived in Talaban.
a. Solution
SELECT L_NAME "LAST NAME",F_NAME"FIRST NAME" FROM `customer`
WHERE ADDRESS IN (SELECT ADDRESS FROM customer WHERE
ADDRESS='TALABAN');
b. Result
4 Result(s) found
3. Write a query that display the last name contact number of employees who lived in
Binalbagan.
a. Solution
SELECT LAST_NAME "LAST NAME", CONTACT_NUM " employee contact
number" FROM `employee` WHERE ADDRESS IN (SELECT ADDRESS FROM
employee WHERE ADDRESS='Binalbagan');
b. Result
2 Result(s) found.
Select Statements using Count and Group Functions
14
SELECT COUNT(CONTAINER_NAME) " total number of containers",
CONTAINER_NAME "container name" FROM containers GROUP by
CONTAINER_NAME;
b. Result
3 result(s) found.
2. Create a query that display the number of customer that transact on the address in
the database.
a. Solution
SELECT COUNT(L_NAME)"total number of customer",ADDRESS FROM
`customer` GROUP by ADDRESS;
b. Result
7 result(s) found.
15
SELECT STATEMENT USING DIFFERENT JOINS
1. Create a query that display the customer full name, total cost of purchased
product, the amount tender and the changed of the customer.
a. Solution
SELECT concat(customer.L_NAME," ",customer.F_NAME) "customer full
name",payment.TOTAL_COST"totalcost",payment.AMOUNT_RECEIVED
"amount render",payment.CHANGED FROM customer INNER JOIN payment
on customer.CUSTOMER_ID=payment.CUSTOMER_ID;
b. Result
9 result(s) found.
6 result(s) found.
3. Show the list of customer number ,last name, and the employee first name.
a. Solution
SELECT customer.CUSTOMER_ID AS "customer number",
customer.L_NAME AS " Customer Last Name", employee.F_NAME AS
" Employee First Name" FROM customer LEFT JOIN employee ON
16
customer.CUSTOMER_ID = employee.EMPLOYEE_ID ORDER BY
customer.CUSTOMER_ID;
b. Result
17 result(s) found.
4. Write a query that will display the delivery id, customer complete name in upper
case format. Show also the list of delivery man and the date when the product
will be deliver.
a. Solution
SELECT Upper(concat( customer.L_NAME,"
",customer.F_NAME))"Customer
Name",delivery.DELIVERY_MAN"delivery
man",delivery.DATE,delivery.DELIVERY_ID FROM customer RIGHT
JOIN delivery ON customer.CUSTOMER_ID=delivery.CUSTOMER_ID
ORDER BY customer.L_NAME;
b. Result
11 result(s) found.
5. Display the product name, transaction type and the total cost.
a. Solution
17
11 result(s) found.
18
Insert Statement
1. Create a query to insert 10 new alkaline product and its price is 25 pesos in
March 23 2019.
a. Solution
INSERT INTO `product` (`product_id`, `Product_name`, `Quantity`,
`Unit_price`) VALUES ('1024', 'alkaline', '10', '25');
b. Result
1 row(s) inserted.
19
2. Create a query to insert new customer whose named is Jason Tenido living in
Brgy.4 and has contact number of 09122345757 while Carlos Hilado lived in
Brgy.Carabalan and has contactnumber of 09367281123.
a. Solution
INSERT INTO `customer` (`CUSTOMER_ID`, `F_NAME`, `L_NAME`, `ADDRESS`,
`CONTACT_NUM`, `DATE`) VALUES ('116', 'Jason', 'Tenido', 'Brgy.4',
'09122345757', CURRENT_TIMESTAMP), ('117', 'Carlos', 'Hilado',
'Brgy.Carabalan', '09367281123', CURRENT_TIMESTAMP);
b. Result
2 record(s) inserted.
20
3. Create a query to insert new employee whose name is roel gecosala 27 years old
who lived in bgry.enclaro and has a contact number of 09214567999.
a. Solution
INSERT INTO `employee` (`EMPLOYEE_ID`, `F_NAME`, `LAST_NAME`,
`AGE`, `ADDRESS`, `CONTACT_NUM`) VALUES ('55', 'Roel', 'Gecosala',
'27', 'BRGY.ENCLARO', '09214567999');
b. Result
2 record(s) inserted.
21
a. Solution
INSERT INTO `containers` (`CONTAINER_ID`, `CONTAINER_NAME`,
`QUANTITY`, `UNIT_PRICE`) VALUES ('11', 'round container', '10', '125');
b. Result
1 Record(s) inserted.
22
a. Solution
INSERT INTO `transaction` (`TRANSACTION_ID`, `PRODUCT_ID`,
`QUANTITY`, `TRANS_TYPE`, `UNIT_PRICE`, `TOTAL`, `DATE`) VALUES
('10112', '1012', '5', 'refill', '25', '125', CURRENT_TIMESTAMP);
b. Result
2 record(s) inserted.
23
Update Statement
a. Solution
UPDATE `employee` SET `LAST_NAME` = 'Delagon', ` WHERE
`employee`.`EMPLOYEE_ID` = 54;
b. Result
1 Record(s) updated.
24
2. Create a query to change the information on the product id 1022 .
a. Solution
UPDATE `product` SET `Product_name` = 'purified', `Quantity` = '2',
`Unit_price` = '45' WHERE `product`.`product_id` = 1022;
b. Result
1 record(s) updated.
25
3. Write a query to change the amount render by the customer having the
payment id of 110A.
a. Solution
UPDATE `product` SET `Product_name` = 'purified', `Quantity` =
'2', `Unit_price` = '45' WHERE `product`.`product_id` = 1022;
b. Result
1 Record(s) updated.
4. Create a query to change the contact number of the employee named May
and add suffix on her name.
26
a. Solution
UPDATE `employee` SET `F_NAME` = 'May', `LAST_NAME` =
'June JR.', `ADDRESS` = 'Talaban', `CONTACT_NUM` =
'09367144277' WHERE `employee`.`EMPLOYEE_ID` = 111;
b. Result
1 record(s) updated
5. Create a query to change the product id and the price of the newly inserted
product .
27
a. Solution
UPDATE `product` SET `product_id` = '1024', `Unit_price` = '35'
WHERE `product`.`product_id` = 0;
b. Result
1 Record(s) updated
Delete Statement
1. Create a query to delete one data in customer record who transact on February 23,
2019.
28
a. Solution
DELETE FROM customer WHERE DATE='2019-02-23'
b. Result
1 row(s) deleted.
a. Solution
DELETE FROM employee where employee_id=5;
b. Result
1 row(s) deleted
29
a. Solution
DELETE FROM transaction WHERE PRODUCT_ID = 1002;
b. Result
1 row(s) deleted.
4. Write a query that will remove the product has the product id of 1006.
a. Solution
DELETE FROM product WHERE Product_name=1006;
b. Result
1 row(s) deleted.
a. Solution
DELETE FROM containers WHERE CONTAINER_NAME='bottle';
b. Result
2 row(s) deleted.
30
Sample Records
21 result(s) found.
21 result(s) found.
31
3. Write a query to show all the records of product.
a. Solution
SELECT * FROM `product`;
b. Result
22 result(s) found.
7 result(s) found.
32
5. Write a query to show all the records of transaction.
a. Solution
SELECT * FROM `transaction`;
b. Result
12 result(s) found.
11 result(s) found.
33
11
result(s) found.
34