0% found this document useful (0 votes)
100 views

11 Database Design

The document describes the database design for an agricultural product marketplace called "iAgro". The database contains 19 tables to store information on administrators, articles, categories, locations, customers, products, purchases, sellers, and workers. Each table structure is defined, including field names and types. The tables are related to each other to store information about users, products, purchases and sales on the marketplace. The database is implemented using MySQL.

Uploaded by

Deepu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

11 Database Design

The document describes the database design for an agricultural product marketplace called "iAgro". The database contains 19 tables to store information on administrators, articles, categories, locations, customers, products, purchases, sellers, and workers. Each table structure is defined, including field names and types. The tables are related to each other to store information about users, products, purchases and sales on the marketplace. The database is implemented using MySQL.

Uploaded by

Deepu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

www.studentprojectguide.

com

Database Design
Introduction:

 Database: A Database is collection of related data, which can be of any size and complexity.
By using the concept of Database, we can easily store and retrieve the data. The major purpose
of a database is to provide the information, which utilizes it with the information’s that the
system needs according to its own requirements.

 Database Design: Database design is done before building it to meet needs of end-users
within a given information-system that the database is intended to support. The database design
defines the needed data and data structures that such a database comprises

The database is physically implemented using MySQL.

The database for “iAgro” is organized into 19 tables:

 admin
 article
 category
 city
 country
 customer
 produce
 product
 product_purchase_bill
 product_purchase_record
 purchase_order
 purchase_order_bill
 purchase_request
 seller
 selling_product
 state
 variety

26
www.studentprojectguide.com

 worker
 worker_request

Each entity can be described as follows along with its attributes:


1. Database tables:

Structure of Table “admin”:

Field Name Field Type Size Description


admin_id int 10 Admin ID
admin_name varchar 25 Admin Name
login_id varchar 20 Login ID
password varchar 50 Password
status varchar 10 Status

Structure of Table “article”:

Field Name Field Type Size Description


article_id Int 10 Article ID
article_type varchar 25 Article type
publish_date date Publishing date of the article
title varchar 100 Title of the article
article_description text Description of the article
article_img1 varchar 100 Image of the article
article_img2 varchar 100 Image of the article
article_img3 varchar 100 Image of the article
article_img4 varchar 100 Image of the article
article_img5 varchar 100 Image of the article
status varchar 10 Status

Structure of Table “category”:

Field Name Field Type Size Description


category_id int 10 Category ID
category varchar 25 Category
category_type varchar 25 Category type
description text Description
img varchar 100 Image
satus varchar 10 Status

Structure of Table “city”:

Field Name Field Type Size Description


city_id Int 10 City ID
country_id Int 10 Country ID
state_id Int 10 State ID
City varchar 25 City

27
www.studentprojectguide.com

description text Description


status varchar 10 Status

Structure of Table “country”:

Field Name Field Type Size Description


country_id int 10 Country ID
country varchar 25 Country
description text Description
status varchar 10 Status

Structure of Table “customer”:

Field Name Field Type Size Description


customer_id int 10 Customer ID
customer_name int 25 Customer Name
address int Address
country_id varchar 10 Country ID
state_id varchar 10 State ID
city_id varchar 10 City ID
pincode varchar 10 Pincode
contact_no varchar 15 Contact number
mobile_no varchar 15 Mobile number
email_id varchar 50 Email ID
password varchar 25 Password
customer_type varchar 25 Customer Type
status varchar 10 Status

Structure of Table “produce”:

Field Name Field Type Size Description


produce_id int 10 Produce ID
category_id Int 10 Category ID
produce varchar 25 Produce
description text Description
img varchar 100 Image
status varchar 10 Status

Structure of Table “product”:

Field Name Field Type Size Description


product_id int 10 Product ID
seller_id int 10 Seller ID
category_id int 10 Category ID
produce_id int 10 Produce ID
variety_id int 10 Variety ID
Title varchar 100 Title

28
www.studentprojectguide.com

img_1 varchar 100 Image of the product


img_2 varchar 100 Image of the product
img_3 varchar 100 Image of the product
img_4 varchar 100 Image of the product
img_5 varchar 100 Image of the product
Quantity float 10,2 Quantity
quantity_type varchar 25 Quantity type
description text Description
uploaded_date date Uploaded date
status varchar 10 Status

Structure of Table “product purchase bill”:

Field Name Field Type Size Description


product_purchase_bill_id int 10 Product purchase bill ID
country_id int 10 Country ID
state_id int 10 State ID
city_id int 10 City ID
customer_name varchar 25 Customer Name
customer_address text Customer Address
pincode varchar 10 Pincode
customer_contact_number varchar 15 Customer Contact Number
purchase_date date Purchase Record
Status varchar 10 Status
payment_type varchar 25 Payment Type
payment_description text Payment Description
seller_id int 10 Seller ID

Structure of Table “product_purchase record”:

Field Name Field Type Size Description


purchase_record_id int 10 Purchase record ID
product_purchase_bill_id int 10 Product purchase bill ID
selling_product_id int 10 Selling Product ID
quantity int 10 Quantity of the product
cost float 10,2 Cost of the product
Status varchar 10 status

Structure of Table “purchase_order”:

Field Name Field Type Size Description


purchase_order_id int 10 Purchase Order ID
product_id int 10 Product ID
purchase_request_id int 10 Purchase Request ID
customer_id int 10 Customer ID
seller_id int 10 Seller ID
purchase_order_date date Date of purchase order
purchase_order_time time Time of purchase order

29
www.studentprojectguide.com

purchase_amt float 10,2 Amount of purchase order


quantity float 10,2 Quantity of purchase order
status varchar 10 Status of purchase order

Structure of Table “purchase_order_bill”:

Field Name Field Type Size Description


purchase_order_bill_id int 10 Purchase order bill ID
purchase_order_id int 10 Purchase order ID
payment_type varchar 20 Mode of payment
payment_description text Description of the payment
paid_date date Date of payment made
paid_amt float 10,2 Amount paid
status varchar 10 Status of purchase order bill

Structure of Table “purchase_request”:

Field Name Field Type Size Description


purchase_request_id int 10 Purchase Request ID
customer_id int 10 Customer ID
product_id int 10 Product ID
quantity float 10,2 Quantity of purchase request
request_date date Date of purchase request
request_date_expire date Expiry date of purchase request
note text Note on Purchase Request
status varchar 20 Status of purchase request

Structure of Table “seller”:

Field Name Field Type Size Description


seller_id int 10 Seller ID
seller_name varchar 25 Name of the seller
seller_address text Address of the seller
state_id int 10 State ID
country_id int 10 Country ID
city_id int 10 City ID
pincode varchar 10 Pincode of the seller’s location
contact_number varchar 15 Contact Number of the seller
mobile_no varchar 10 Mobile Number of the seller
email_id varchar 50 E-Mail of the seller
password varchar 25 Password to login
bank_name varchar 50 Name of the bank
bank_branch varchar 50 Branch Name of the bank
bank_IFSC varchar 25 IFSC Code of seller’s bank account
bank_acno varchar 25 Seller’s bank account number
status varchar 10 Status of the seller

Structure of Table “selling_product”:

30
www.studentprojectguide.com

Field Name Field Type Size Description


selling_prod_id int 10 Selling product ID
category_id int 10 Category ID
product_name varchar 25 Name of the product
product_ description text Description of the product
product_img1 varchar 100 Image of the product
product_img2 varchar 100 Image of the product
product_img3 varchar 100 Image of the product
product_img4 varchar 100 Image of the product
product_img5 varchar 100 Image of the product
quantity_type varchar 50 Quantity Type
cost float 10,2 Cost of the product on sale
status varchar 10 Status of the product on sale

Structure of Table “state”:

Field Name Field Type Size Description


state_id int 10 Primary key
country_id int 10 Foreign key
state varchar 25 Name of the state
description text Description of the state
status varchar 10 Status of the state

Structure of Table “variety”:

Field Name Field Type Size Description


variety_id int 10 Variety ID
category_id int 10 Category ID
produce_id int 10 Produce ID
variety varchar 25 Name of the produce variety
description text Description about the variety
img varchar 100 Image of the produce variety
status varchar 10 Status of the produce variety

Structure of Table “worker”:

Field Name Field Type Size Description


worker_id int 10 Worker ID
name varchar 50 Name of the worker
address text Address of the worker
state_id int 10 State ID
city_id int 10 City ID
country_id int 10 Country ID
pincode varchar 10 Pincode of the worker’s location
work_profile text Services provided by the worker
biodata varchar 100 Biodata of the worker
contactno varchar 15 Contact Number
date_of_birth date Date of birth of the worker

31
www.studentprojectguide.com

login_id varchar 100 Worker’s login ID


password varchar 100 Worker’s password to login
expected_salary float 10,2 Salary range the worker expects
status varchar 10 Status of the worker

Structure of Table “worker_request”:

Field Name Field Type Size Description


worker_request_id int 10 Worker Request ID
worker_id int 10 Worker ID
seller_id int 10 Seller ID
from_date date Date of commencement of work
to_date date Date of completion of work
task text Task to be done by the worker
country_id int 10 Country ID
state_id int 10 State ID
city_id int 10 City ID
salary float 10,2 Salary provided
salary_type varchar 20 Type of salary
seller_status varchar 20 Status of the seller
worker_status varchar 20 Status of the worker
seller_comment text Comment by the seller
worker_comment text Comment by the worker

2. Entity-Relationship Diagram:

An entity-relationship (ER) diagram is a specialized graphic that illustrates the relationships


between entities in a database. ER diagrams often use symbols to represent three different types
of information. Boxes are commonly used to represent entities. Diamonds are normally used to
represent relationships and ovals are used to represent attributes.

The Symbols are shown in below table:

Name Notation Description


Entity Entity is represented by a
box within the ERD.
Entities are abstract
concepts, each representing
one or more instances of the
concept in question. An
entity might be considered a
container that holds all of
the instances of a particular
thing in a system. Entities
are equivalent to database

32
www.studentprojectguide.com

tables in a relational
database, with each row of
the table representing an
instance of that entity.
Relationships are
represented by Diamonds.
A relationship is a named
collection or association
between entities or used to
Relationship relate to two or more
entities with some common
attributes or meaningful
interaction between the
objects.

Attributes are represented


by Oval. An attribute is a
single data item related to a
database object. The
Attributes database schema associates
one or more attributes with
each database entity.

33
www.studentprojectguide.com

ER-Diagram:

admin_name login_id country_id country country_id

password description
state_id

state
admin_id admin adds country
adds
state

has
publish

creates adds
adds city_id
category_id
article_id article city

category country_id
adds
category
article_type title state_id

category_type
seller_id city
seller
posts
contains provides C
selling_prod_id

has seller_address seller_name

selling_product takes produce_id product_id


cost

produce product seller_id


product_name variety_id variety produce

quantity

category_id
category_id variety has

B for

defines

34
www.studentprojectguide.com

receives

purchase_request_id

request_date
purchase_request

customer_id

quantity

requires

purchase_order_id

purchase_order_time

purchase_order

purchase_order_date

generates

purchase_order_bill-id

purchase_order_bill purchase_order_id

paid_amt

35
www.studentprojectguide.com

customer_id B

customer_name customer

address from

buy

purchase_record_id

product_purchase_record

quantity

cost

generates

product_purchase_bill_id

product_purchase_bill customer_name

purchase_date

36
www.studentprojectguide.com

C worker_id

name

worker

address

sends

receives

from_date

worker_request

to_date

worker_request_id
task

37
www.studentprojectguide.com

Database schema Diagram:

38

You might also like