2. DATABASEOF E-COMMERCE COMPANY
The database protects and maintains data and can perform basic operations such as associating it
with other data. By using the database, the data can be used more easily, the desired data can be
easily accessed, and new information can be produced to help solve various problems. It provides
efficiency and security in data entry and access by collecting data in a center, allowing everyone to
access, correction, delete or view these data within their authority.
In this project, I created a relational database using data from an e-commerce company. The
purpose of using the database in this project is to provide easy and fast access to data and to
perform transactions . It also stores a lot of data with very little space. It is easy to add new data
and to edit or delete old data. I can easily query sales transactions, product information, stocks and
customer information in this database. We can manage the database , perform storage,
reproduction and updating. An e-commerce company is required to keep the information of
members and products on the shopping site. For this, the data must be stored in the database.For
example, in order for the products to reach the customers, the address information of the
customers must be stored in a database. The database makes the application more useful by
preventing unnecessary data duplication. It ensures that the data is consistent.
4. Primary key must be unique. It cannot be changed and cannot be left blank.
Foreign keys don’t have to be unique.They can be repeated in a table.There can be multiple
foreign keys in one entity.
5. Caıluım n Nlame
Ssn
Fi
rstıNarme
La
stıf'/Jarıne
Ermai
l
� pıhl]ne
Street
,
Oity.
Zip
Tabıle Mame: _l
rn_sm_
1 m
_
e
_
r
________________�I Schıema: e_mımneroe
aharse t/Col latiaın: .__Iu_tffi_m _b4
_______
v__.l l utffim b4_ 0900_ai_d v I Engi
n
e:' _IIn_n _oD _B___
Caım men'ts:
Datatııpe PK NINI IJJQ B IJJNI ZF AI G Derauıl tfExp ress iaın
CH R{91) 0 0 □ □ □ □ □ □
V RCH R{:15) □ 0 □ □ □ □ □ □
V. ·RCH. ·R{lS) □ 0 □ □ □ □ □ □
· ROH R{30) □ 0 □ □ □ □ □ □
V RCH R{:12) □ 0 □ □ □ □ □ □
V. ·RCH ·R{SO) □ 0 □ □ □ □ □ □
V . RCH . R{:15) □ 0 □ □ □ □ □ □
V ROH. R{S}. □ 0 □ □ □ □ □ □
Creditcard ID INT □ 0 □ □ □ □ □ □
□ □ □ □ □ □ □ □
6.
7.
8.
9.
10.
11.
12.
13.
14. Defining the Attribute's Data Type
Textual Data Types
CHAR(length) : Includes text (characters,numbers,punctuations...).CHAR has as characteristicthat it always
saves a fixed amount of positions.
VARCHAR(length) : Includes text (characters,numbers, punctuation...).VARCHAR is the same as CHAR, the
difference is that VARCHAR only takes as much space as necessary.
TEXT : can contain large amounts of text.
Numberical Data Types
INT: Contains a positive or negative whole number. A lot of databases have variations of the INT, such as
TINYINT,SMALLINT,MEDIUMINT, BIGINT,INT2,INT4,INT8. These variations differ from the INT only in the size
of the figure that fits into it.
FLOAT,DOUBLE: The same idea as INT, but can also store floating point numbers.
Date / Time Data Types
Date: YYYY.MM.DD
Date Time: YYYY.MM.DD hh:mm:ss
Other Types
• BLOB : for binary datasuch as files.
• INET : for IP addresses. Also useable for netmasks.
23. Data Description Language
• Create: Defines objects. Primary keys are defined here.
• Alter: Makes changes on objects. Foreign keys are defined here.
• Drop: Deletes objects.
Data Processing Language
• Insert: Inserts data into the table
• Update: Updates the data in the table
• Delete: Deletes the data in table.
• Select: Selects the data we want in the table and reports it.
35. ER Diagrams Symbols & Notations
Entity Relationship Diagram Symbols & Notations mainly contains three basic symbols
which are rectangle, oval and diamond to represent relationships between elements,
entities and attributes.ER Diagram is a visual representation of data that describes how
data is related to each other using different ERD Symbols and Notations.
Following are the main components and its symbols in ER Diagrams:
• Rectangles: This Entity Relationship Diagram symbol represents entity types
• Ellipses : Symbol represent attributes
• Diamonds: This symbol represents relationship types
• Lines: It links attributes to entity types and entity types with other relationship types
• Primary key: attributes are underlined
• Double Ellipses: Represent multi-valued attributes
36.
37. Cardinality
Defines the numerical attributes of the relationship between two entities or
entity sets.
Different types of cardinal relationships are:
• One-to-One Relationships
• One-to-Many Relationships
• Many-to-One Relationships
• Many-to-Many Relationships
38.
39. 1.One-to-one:One entity from entity set X can be associatedwith at most one entity of
entity set Y and vice versa.
2.One-to-many:One entity from entity set X can be associatedwith multiple entities of entity
set Y, but an entity from entity set Y can be associated with at least one entity.
3. Many-to-One:More than one entity from entity set X can be associatedwith at most one
entity of entity set Y. However, an entity from entity set Y may or may not be associated
with more than one entity from entity set X.
4. Many-to-Many: One entity from X can be associatedwith more than one entity from Y
and vice versa.
42. Relationships Between Entities and Their Types
• While a customer may purchase multiple products, multiple customers may purchase a
product .
• While a customer can place multiple orders, a customer can place an order.
• While a customer can make a transaction from one credit card, more than one customer
can make a transaction from a credit card.