4.2.4.1. Normalisasi
Normalisasi dipakai untuk membuat struktur tabel relasi dalam basis data.
Tabel 4.4 Normalisasi
Unnormal username, password, priv, firstname, lastname, email, phone, address, city, zipcode,
country, region, order_timestamp, product_id, product_name, product_description, product_image, product_price, product_qty, on_special, product_timestamp, weight,
length, width, height, discount, category_name, category_description, order_status, order_amount, shipcost, shipdate, comments, invno
Normalisasi Pertama product_id, product_name, product_description, produk_image, product_price,
on_special, product_timestamp, weight, length, width, height, discount, stock, category_name, category_description
order_id, invno, product_id, price, qty, username, password, priv, firstname, lastname, email, phone, address, city, zipcode, country, region, order_timestamp, order_status,
order_comments, amount, shipcost, shipdate
Normalisasi Kedua category_id, parent_id, category_name, category_description
product_id, product_name, product_description, image, price, on_special, timestamp, avaliable, weight, length, width, height, discount, stock, category_id
username, password, priv, firstname, lastname, email, phone, address, city, zipcode, country, region, shipcost
order_id, username, o_timestamp, a_timestamp, status, status_details, custinfo, comments, amount, invno, product_id, price, qty, discount, shipdate
Normalisasi Ketiga categories
: id, parent_id, name, description
products : id, name, description, image, price, on_special, timestamp, avaliable, weight,
length, width, height, discount, stock products_categories
: product_id, category_id users
: username, password, priv, firstname, lastname, email, phone, address, city,
zipcode, region, country city
: cityid, regid, name, shipcost
region : regid, countryid, name
country : countryid, name
orders : id, username, o_timestamp, a_timestamp, status, status_details, custinfo,
comments, amount, shipcost, invno, shipdate, total_weight, per_kg
order_details : order_id, product_id, product_name, price, qty, discount, weight
4.2.4.2.Relasi Tabel
Skema relasi merupakan hubungan antara beberapa tabel yang saling memiliki keterkaitan data dan tidak dapat dipisah-pisahkan. Tabel tersebut menampung atau
berisi data-data yang terdapat didalam sistem tersebut. Gambar dibawah ini menjelaskan tabel relasi yang akan dibangun pada aplikasi e-commerce CindyShop.
categories
PK id
parent_id name
description
orders
PK id
FK1 username o_timestamp
a_timestamp status
status_detail custinfo
comments amount
shipcost invno
shipdate total_weight
per_kg order_items
PK,FK2 order_id PK,FK1 product_id
product_name price
qty discount
weight products
PK id
name description
image price
on_special timestamp
avaliable weight
length width
height discount
stock products_categories
PK,FK1 product_id PK,FK2 category_id
users
PK username
password priv
firstname lastname
email phone
address FK1 city
zipcode FK3 country
FK2 region city
PK cityid
FK1 regid name
shipcost region
PK regid
FK1 countryid name
country
PK countryid
name F1
F2 F3
F1
F2 F3
Gambar 4.20 Tabel Relasi Aplikasi E-commerce CindyShop
4.2.4.3. Entity Relationship Diagram ERD