AMERICAN INTERNATIONAL UNIVERSITY –BANGLADESH
(AIUB)
FACULTY OF SCIENCE & TECHNOLOGY
INTRODUCTION TO DATABASE (CSC2108)
Semester: FALL 2024-2025
Section: [Z ] Group no: 4
Barta Parcel Management System
Supervised By
Dr. Razuan Karim
Submitted By:
Name ID
MD. RAKUBUL HASAN 23-54956-3
MOSTAFIJUR RAHMAN MAHIR 23-54958-3
MD. HASIBUL HASAN HASIB 23-54870-3
MD. TANVIRUL ISLAM NAYEM 23-53379-3
1
TABLE OF CONTENTS
TITLE Page -1
INTRODUCTION Page -3
CASE STUDY Page -4
ER DIAGRAM Page -5
NORMALIZATION Page - 6-12
FINALIZATION Page- 12
TABLE CREATION Page- 13-19
VALUE INSERTION Page-20-29
QUERY TESTING Page- 30-39
DATABASE CONNECTION Page- 40-43
CONCLUSION Page -44
2
Introduction
The Barta Parcel Management System is designed to efficiently
manage and store data of customers (senders), receivers,
deliverymen, and parcels. Using Oracle Database 10g Express
Edition for data storage and queries, and EdrawMax Online for
ER diagrams, the system ensures secure and user-friendly data
access and modification. It aims to simplify parcel management,
enhance safety, and inspire other systems to adopt efficient
practices for global parcel delivery with speed and reliability.
3
Case Study
In the parcel management system, a customer(sender) may send
many parcels, but a parcel may be sent by exactly one customer.
A customer is identified by a customer_id. The system also
stores customer_name, date_of_birth, customer_address and
phone_number. A customer_address is composed of city,
street_name and house_number. A parcel is identified by
parcel_id. The entity parcel also stores parcel_type, weight(kg)
and regular_price. A receiver may receive several parcels and a
parcel only belongs to a receiver. Receiver is identified by a
receiver_id. For receiver, the system also stores receiver_name,
date_of_birth and phone_number. The receiver_address is also
made of city, street_name and house_number. While sending
and receiving, both dates are saved in the system. A
deliveryman delivers at least one parcel and many parcels are
delivered by exactly one deliveryman. Deliveryman is identified
by d_id. D_name, date_of_birth, area_coverage, phone_number
and nid_number of the deliveryman are also stored in the system.
When the payment is completed by the receiver to the
deliveryman, the amount of cash received from the receiver is
also stored.
4
E-R Diagram
5
Normalization
For sent:
Fig: customer – sent - percel
Relation: One to Many
UNF:
customer_id, customer_name, date_of_birth, phone_number, city,
street_name, house_number, parcel_id, parcel_type, weight(kg),
regular_price(tk)
1NF:
customer_id, customer_name, date_of_birth, phone_number, city,
street_name, house_number, parcel_id, parcel_type, weight(kg),
regular_price(tk)
2NF:
customer_id, customer_name, date_of_birth, phone_number, city,
street_name, house_number
parcel_id, parcel_type, weight(kg), regular_price(tk), customer_id
3NF:
6
customer_id, customer_name, date_of_birth, phone_number,
customer_address
city, street_name, house_number
parcel_id, parcel_type, weight(kg), regular_price(tk), customer_id
For received_by:
Fig: parcel – received_by - receiver
Relation: Many to one
UNF:
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, parcel_id, parcel_type, weight(kg),
regular_price(tk)
1NF:
7
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, parcel_id, parcel_type, weight(kg),
regular_price(tk)
2NF:
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, parcel_id
parcel_id, parcel_type, weight(kg), regular_price(tk)
3NF:
receiver_id, receiver_name, date_of_birth, phone_number,
receiver_address, parcel_id
city, street_name, house_number,
parcel_id, parcel_type, weight(kg), regular_price(tk)
8
For delivered_by:
Fig: parcel – delivered by - delivery man
9
Relation: many to one
UNF:
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number,
parcel_id, parcel_type, weight(kg), regular_price(tk)
1NF:
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number,
parcel_id, parcel_type, weight(kg), regular_price(tk)
2NF:
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number
parcel_id, parcel_type, weight(kg), regular_price(tk), d_id
3NF:
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number
parcel_id, parcel_type, weight(kg), regular_price(tk), d_id
10
For paid_to:
Fig: receiver-paid to- delivery man
Relation: many to one
UNF:
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, d_id, d_name, date_of_birth, area_coverage,
phone_number, nid_number
1NF:
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, d_id, d_name, date_of_birth, area_coverage,
phone_number, nid_number
2NF:
receiver_id, receiver_name, date_of_birth, phone_number, city,
street_name, house_number, d_id
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number
3NF:
11
receiver_id, receiver_name, date_of_birth, phone_number,
customer_address, d_id
city, street_name, house_number
d_id, d_name, date_of_birth, area_coverage, phone_number, nid_number
Finalization
1st : customer_id, customer_name, date_of_birth, phone_number,
customer_address
2nd : city, street_name, house_number
3rd : parcel_id, parcel_type, weight(kg), regular_price(tk), customer_id,
d_id
4th : receiver_id, receiver_name, date_of_birth, phone_number,
customer_address, d_id
5th : city, street_name, house_number
6th : d_id, d_name, date_of_birth, area_coverage, phone_number,
nid_number
7th : customer_id, parcel_id, date_of_sent
8th : receiver_id, parcel_id, date_of_received
9th : receiver_id, d_id, cash_received(tk)
12
Table Creation (DDL Operations)
1.CUSTOMER
13
2.CUSTOMER ADDRESS
3.RECEIVER
14
4. RECEIVER_ADDRESS
15
5. DELIVERYMAN
16
6. PARCEL
7.WEIGHTGRADE
8.SENT
17
9. RECEIVED_BY
18
10. PAID_TO
SELECT * FROM user_tables;
19
Inserted Values in the tables
1.Customer
20
2.CUSTOMER_ADDRESS TABLE
21
3. RECEIVER TABLE
22
4.RECEIVER_ADDRESS TABLE:
23
5. DELIVERYMAN TABLE:
24
6.PARCEL TABLE
25
7. WEIGHTGRADE TABLE
26
8. SENT TABLE
27
9.RECEIVED_BY TABLE
28
11. FOR PAID_TO TABLE
29
Query Test in DB
Simple Query:
Show receiver IDs with their parcel IDs who have received their parcel in the month
February.
Single Row Function:
Show receiver IDs with their names who are adults (age 18 or greater). And search
‘E’ in their names.
30
Multiple Row Function:
Show maximum receiver ID, minimum receiver ID, total number of receivers and
total number of available phone numbers.
31
Single Row Subquery:
Show all the information of the deliveryman who received the maximum amount of
cash from the receiver.
32
Multiple Row Subquery:
Show parcel ID, parcel type, weight and regular price where regular price is greater
than the average price and was sent before 4th April, 2024.
Joining:
Equijoin:
Show the receiver IDs and names with corresponding deliveryman IDs and names.
33
Non-equijoin:
Show the weight grade for each parcel.
34
Outerjoin:
Show customer id and name along with the parcel IDs of the parcels they have sent.
35
36
Selfjoin:
Show whether 2 persons have common deliveryman ID and receiver ID.
37
Simple View:
Create a view as eidDisc to show special price for Eid with 20% discount to all the
parcels.
SELECT * FROM eidDisc;
38
Complex View:
Create a view changeAmount to show the cash amount the deliverymen received from
the receivers, their regular prices and changes they had to provide.
SELECT * FROM changeAmount ;
39
Database Connection
Process:
To connect a Database with JDBC we need 3 things.
1. MySQL java connector (jar file). We went to (Maven Repository:
mysql » mysql-connector-java (mvnrepository.com)) and
download a version from there.
2. We need XAMPP. Xampp can be downloaded from here
(Download XAMPP (apachefriends.org)).
3. We can use any IDE. In our project VScode has been used.
1) We Started the XAMPP app then started both Apache and MySQL.
Next, we went to MySQL admin panel.
2) Now we created a Database, inside of it created a table and inserted
the values in the table.
3)
Next we opened the IDE (VScode).
i. Create a project. Add the jar file to the libraries.
ii. In source package create folder. In the folder create a java file.
40
iii. Now to write the code we need to understand the steps of
Database connection.
• Register driver.
• Connect the database.
• Create a statement.
• Execute the query().
• Connection close().
Fig: Connection Code
Fig: results
41
About Database Connection & Its Features
A database connection is like a virtual bridge between a computer
program (like a website or application) and a storage area for information,
known as a database. It allows the program to interact with and retrieve
data from the database.
Key Features:
1.Connection String:
Think of it as a secret code that the program uses to find
the database. It contains details like where the database is
located and how to get in.
2.Connection Pooling:
Imagine a shared pool of workers. Instead of hiring new
workers every time a job needs to be done, the program
reuses existing workers to save time and effort
3. Authentication:
Like showing a badge to enter a secure area,
authentication ensures that only authorized users or
programs can access the database.
4. Transaction Management:
Transactions are like making several moves in a game.
Either all the moves happen together, or none of them do.
This ensures that the database stays in a good state.
5. Error Handling:
When something goes wrong (like a misspelled
command), error handling helps the program understand
and respond appropriately without crashing.
6. Concurrency Control:
42
Imagine people sharing a document. Concurrency control
ensures that changes made by one person don't mess up
what another person is doing.
7. Database Drivers:
Just as you need a specific key for different locks,
database drivers are like keys that help the program
communicate with different types of databases.
8. SSL/TLS Encryption:
It's like sending a secret letter in a locked box. SSL/TLS
encryption ensures that information traveling between the
program and the database is secure and private.
9. Connection Timeouts:
This is like setting a timer. If the program can't connect to
the database within a certain time, it gives up preventing
waiting forever.
10. Connection States:
Think of a connection as a light switch—it can be off, on,
or doing something. Understanding connection states
helps the program manage its interactions with the
database effectively.
In simple terms, database connection features are like a set of rules and
tools that help programs talk to databases in a secure, reliable, and
efficient way.
43
Conclusion
The Barta Parcel Management System is built for advanced data management with 10
primary tables: customer, customer_address, receiver, receiver_address, parcel,
deliveryman, sent, received_by, paid_to, and weightgrade. Designed for large
commercial institutions, the system ensures efficient, secure, and reliable data
processing. Future updates will accommodate growing data needs, aiming to simplify
data access, prevent corruption, and eliminate loss, making regular data management
seamless and robust.
44