database project
database project
(AIUB)
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
3
Case Study
4
E-R Diagram
5
Normalization
For sent:
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:
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:
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:
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
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
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.
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.
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.
39
Database Connection
Process:
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.
3)
Next we opened the IDE (VScode).
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: results
41
About Database Connection & Its Features
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.
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