0% found this document useful (1 vote)
2K views

Water Refilling System PDF

The document describes a database design for an Aqua Water Refilling Management System. It includes entity relationship diagrams and data dictionaries that define the tables, fields, data types, and relationships between tables for managing customer information, products, deliveries, containers, employees, and payments. The purpose is to automate the operations of a water refilling station and improve efficiency over a manual system.

Uploaded by

Bryan Paz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views

Water Refilling System PDF

The document describes a database design for an Aqua Water Refilling Management System. It includes entity relationship diagrams and data dictionaries that define the tables, fields, data types, and relationships between tables for managing customer information, products, deliveries, containers, employees, and payments. The purpose is to automate the operations of a water refilling station and improve efficiency over a manual system.

Uploaded by

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

AQUA WATER REFILLING MANAGEMENT SYSTEM

A Database Design

In Database Management System 1

Presented to the Faculty of CHMSC ITE Department

In Partial Fulfillment

Of the Requirements for the

Bachelor of Science in information Technology 1

GLADYS T. ELIVER

March 2019

1
TABLE OF CONTENTS

Title Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .i

Table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ii

System Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

Entity Relationship Diagram .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

Database Dictionaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . .3-5

Select Statements using Different Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-11

Select Statements using Sub Query . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . . . . 12

Select Statements using Count and Group Functions . . . . . . . . . . . . . . . . . . . . . 13

Select Statements using Different Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-16

Insert Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 17-21

Update Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22-26

Delete Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27-28

Sample Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29-31

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.

The purpose of water refilling management system is to overcome difficulties in manual


operation in refilling station. The difficulty in manual system are one of the reasons why the
efficiency in availing services of the clients is not satisfying and keeping of records is often
misplaced and not secure.

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:

• Manage user (add, list updates)


• Delivery (confirm, cancel)
• Products (add, delete, update).

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.

Figure 1.Aqua Water Refilling Management System Entity Relationship Diagram

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

FIELD NAMES DESCRIPTION TYPE LENGTH


EMPLOYEE_ID(pk) EMPLOYEE ID INT 11
NUMBER
F_NAME EMPLOYEE FIRST VARCHAR 50
NAME
M_NAME EMPLOYEE MIDDLE VARCHAR 50
NAME
L_NAME EMPLOYEE LAST VARCHAR 50
NAME
AGE AGE OF EMPLOYEE VARCHAR 11
ADDRESS LOCATION OF VARCHAR 50
EMPLOYEE
CONTACT_# NUMBER OF VARCHAR
EMPLOYEE 11

Table 2. Customer

FIELD NAMES DESCRIPTION TYPE LENGTH


CUSTOMER_ID(PK) CUSTOMER ID INT 11
NUMBER
F_NAME CUSTOMER FIRST VARCHAR 50
NAME
M_NAME CUSTOMER MIDDLE VARCHAR 50
NAME
L_NAME CUSTOMER LAST VARCHAR 50
NAME
ADDRESS LOCATION OF VARCHAR 50
CUSTOMER
CONTACT_# NUMBER OF VARCHAR
CUSTOMER 11
DATE DATE OF DATE TIME 11
TRANSACTION

5
TABLE 3. PRODUCT

FIELD NAMES DESCRIPTION TYPE LENGTH


PRODUCT_ID(PK) PRODUCT ID INT 11
NUMBER
PRODUCT_NAME PRODUCT NAME VARCHAR 50

QUANTITY QUANTITY OF INT 11


PRODUCTS
UNIT_PRICE PRICE OF PRODUCTS VARCHAR 50

DATE DATE DATE 11

TABLE 4. DELIVERY

FIELD NAMES DESCRIPTION TYPE LENGTH


DELIVERY_ID(PK) DEELIVERY ID INT 11
NUMBER
CUSTOMER_ID(FK) CUSTOMER ID INT 11
NUMBER
PRODUCT_ID(FK) PRODUCT ID INT 11
NUMBER
TRANSACTION_ID TRANSACTION ID INT 11
NUMBER
QUANTITY QUANTITY OF INT 11
PRODUCTS
DELIVERY_MAN DELIVERY MAN VARCHAR 50
DATE_DELIVER DATE TO DELIVER DATE TIME 11

TABLE5.CONTAINERS

FIELD NAMES DESCRIPTION TYPE LENGTH


CONTAINER_ID CONTAINER ID INT 11
NUMBER
CONTAINER_NO CONTROL NUMBER INT 50

QUANTITY QUANTITY ORDER INT 20


OF CUSTOMER
ON_HAND AVAILABLE VARCHAR 50
CONTAINERS
UNIT_PRICE PRICE OF VARCHAR 11
CONTAINERS

6
TABLE 6.PAYMENT

FIELD NAMES DESCRIPTION TYPE LENGTH


PAYMENT_ID PRODUCT ID INT 11
NUMBER
CUSTOMER_ID CUSTOMER ID INT 50
NUMBER
TRANSACTION_ID DATE OF DATE TIME 11
TRANSACTION
TOTAL TOTAL INT 11
OFPURCHASED
PRODUCT
AMOUNT_RECEIVED AMOUNT INT 11
RECEIVED
CHANGED CHANGED INT 11

TABLE 7.TRANSACTION

FIELD NAMES DESCRIPTION TYPE LENGTH


TRANSACTION_ID PRODUCT ID INT 11
NUMBER
PRODUCT_ID PRODUCT ID INT 50
NUMBER
TRANS_TYPE TYPE OF VARCHAR 11
TRANSACTION
UNIT_PRICE PRICE OF VARCHAR 50
PRODUCT
QUANTITY QUANTITY OF INT 11
PRODUCT
TOTAL TOTAL COST OF INT 11
TRASACTION
DATE DATE DATE 11

7
SELECT STATEMENT USING DIFFERENT FUNCTIONS

1. Create a query that display the complete names of all customer.


a. Solution
SELECT CONCAT (L_NAME,' ', F_NAME ) " CUSTOMER FULL NAMES"
FROM `customer`;
b. Result

15 Result(s) found.

2. Create a query that display all the name of products.


a. Solution
SELECT DISTINCT(product_name) as "Products" FROM `product`;
b. Result

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

6. Write a query that display the maximum amount received.


a. Solution
SELECT MAX(AMOUNT_RECEIVED) " maximum amount received" FROM
`payment`;
b. Result

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

9. Show all the number of customer who transact in each address.


a. Solution
SELECT COUNT(ADDRESS) "number of customer", ADDRESS "customer
address" FROM customer GROUP by ADDRESS;
b. Result

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

20. Display the total of amount received.

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

1. Display the name and the total number of containers.


a. Solution

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.

2. Show the list of product that is purchased through refill.


a. Solution
SELECT product.product_name"product
name",transaction.TRANS_TYPE"transaction type" FROM product INNER
JOIN transaction on product.product_id=transaction.PRODUCT_ID
WHERE trans_type = "refill";
b. Result

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

SELECT product.`product_NAME` AS "product Name",


transaction.`trans_type` AS "transactio type",TOTAL"TOTAL COST" FROM
`product` JOIN transaction
on(transaction.`product_ID`=product.`product_ID`);
b. Result

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.

4. Create a query to insert new 10 round container and cost of 125.

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.

5. Create a query to insert new transaction such that transasction id is 10112,


product id is 1012 ,quantity is 5, transaction type is refill, price is 25 and has a
total cost of 125.

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

1. Create a query to change the last name of noel dalagan to delagon.

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.

2. Create a query to delete one employee.

a. Solution
DELETE FROM employee where employee_id=5;
b. Result

1 row(s) deleted

3. Write a query that will delete a one data on transaction.

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.

5. Remove the container named bottle .

a. Solution
DELETE FROM containers WHERE CONTAINER_NAME='bottle';

b. Result

2 row(s) deleted.

30
Sample Records

1. Write a query to show all the records of customers.


a. Solution
SELECT * FROM `customer`;
b. Result

21 result(s) found.

2. Write a query to show all the records of containers.


a. Solution
SELECT * FROM `containers`;
b. Result

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.

4. Write a query to show all the records of employee.


a. Solution
SELECT * FROM `employee`;
b. Result

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.

6. Write a query to show all the records of payment.


a. Solution
SELECT * FROM `payment`;
b. Result

11 result(s) found.

7. Write a query to show all the records of delivery.


a. Solution
SELECT * FROM `delivery`;
b. Result

33
11
result(s) found.

34

You might also like