Relational DataBase Design Bosies Nas By
“Pelerana Habre.
CHEATSHEET
cueaTSHEsT.
© What i 0 good database design 2
Tints
Ae Divides Your informotion fnto Subject based ‘tables te reduce
redundant data,
Provides Access with the information it requires te Join the
jnformation in the tables teyetner as needed,
3. Peles copport and ensure the Aceursey avd Integr’ ty of your
inforenation.
A, Recommodates your date Processing and reporting needs.
© “The Design Process
Determine the purpose of your datohase
(is eves. prerore yew for Ye remaining Stees)
2. Find ond orgontze tne information required.
fe types of information you might want te record in
Gotner ou of EH
product Name ond Order. number)
tne dotabese, Such 9S
https://www linkedin.com/in/boloram-mitra-963125151/(20 ge es ae nes
oe
wane occa
Za Petre Meg
Fe was meg
(ry
ca pe toe Bans we
eae Se ee ee
Se we oti
ee ome te eas nd nth fw meds
a cnt theta
(ra er ge ons te eo
ethene
er ‘Moke ches © Me
peer ern are =
ose tl)
a er ee
cram eons ysoge emeet see
COTS ae :
fea oy oe 3 :
etree eg Non ring te Ween Pe
Cae gs oe
ae |(© Feten ond orgnsting tne mgpteed formation
> sm ping rin ein rt ti
spoatgboe. eign ot
Te Mieetee be enh ane
7g et ene Seo et
Ca car a ee oe
oom tl ie
Tat
fragt me tn ae nd
> Ta gee ean ann wing sar Un oe
aged ene eteetet ret tet teed
OS ee
SOE A ET EE re
Sha ocr et sn
Se le ge nt ed
pao enone
> te og terns gu my ea as
ere
cuit Arce orm
aye too eo
ied ymin train at
wey‘ viding. tne tnformetion Inte tobles
aformation into tobles ,choose the major entities , or Subjects.
gter Finding ond ongoni ain g information foro Product Soles
> Bb divide kre
gore
ie peoesuieninorss List might Look Uke tals A=
e
customers PRODUCTS _
customers
Nome Product Name
nadaress eine
city , tote, Hnlode Unies iH Stocks
Gevd Email nits on orders
Golwtation
Emoit Address
Sorprers, opens
Company Name order Nuwber
Contact nO. colesperson
order dave
dares,
Product
city, State, Bipcode quontity
Price
Tota
Ffe major entities Shown here ore te products’, ‘Suppliers’, ‘Customers’,
with these four fables.
\ orders’, Therefore ik makes Sense to skor|
e's a good Ctorting Point.
Although tris doesn’t Complete the list , but
Je all information in one joble . For exawmole ,% pu
> Ts wot 0 goad tdea to cul
Ain one table 1 wastes Space
grix details obovt o product ond ICS suppliers
ford woke updates dificutk due to te redundancy. A beer approach to have
a separate toble for Suppliers ond Unk if te the products table. THiS avoids
repeating ‘nforotion ond swates updates easier.
> OF ypy hove the Some information in multiple places, MBAR it’s better tO
updates . Also, soverating
duct lout Kee?
Store 1k in one place, Preventing errors during
fobles helps in Sceneriog Where You want to delete & Pro
Supplier details , TF every thing is im one fable, you cow’t do without
losing, important information « Keer eoch table focused on each subjects;
Lie products, Sepetiers to maintain clority and ovoid Comeltcations. :y
on thems into Columns
® Turning Tnformation
yp Decide what inforsmation you need to treck about the subject in the
Lable to determine for 0 customers table, Column UKE
ome, Address, city-state Zp, Send email, Salutation and Email address
ove o peed ctor bing cecerd) hos te Same Sek af Columns allowtn
you to Store Inform ine Columns bY breaking
Lion , Such as Storing, custo 5 0s Firsk Names and
aching « Consider Serorate column
skate ond postal code. Depending
or meernational Info , Choose
ov postal Cede.
fag colurnns «
point, Eoch
ation for each customer, Re
down informal ner Name!
for easier Sorting ond Se
Lost Nawes
city,
aavess Components Uke
Ge it holds domestic
gtote or Region, and HP Code
for each a
upon Lhe database,
Suitable Columns Ke
Faliow the Steps ——
coleutate dota
A. Don't Tnclud
4, Bont “vee
Avoid Storing calculate
for instance,
uvit on order for each product Category , there
Hptotal Coluwnn in ony table . Trsteod »
4 regulls im tables, let Recess perform Colculations
When needed « {4 theres 0 product, on order report
Shewsing, gudtotals
Ghouldn't be a Units on Order Sul
‘
te product toble Ireludes a units on order Column ond Access
Glculates He gubtotal cach time the report iS generated. Storing,
the Gubtotol self in O fable is necessary.
Store tnformation tm tts Smallest logical Parts
Avoid Combining different Kinds of Information ito 0 single field, Uke samme
eb mes and 4 siti
ow ‘ore © ot volt ne Sond its descriptions, Breaking down
‘ vical poets , Si h cake $i
int va Forts , “ nq Separate frekl for ftest and lack Name on
Preduck nome, Produel Cokepory and T's description , makes fk easi
* smmakes Tt easier
retrieve Individual focks tt Later, “4
Customers Rov
CUSTOMERS vers, SUPPLIERS
| First Nome ‘Product 1D Cope ORDERS
on ‘ pgany nome ————
Last Nome Pravel rome ee Onder number
raavess, Unie price “ene ‘
city Unit in. Cock —_—- ee terson
Region eit te ord Address, Orior date.
Postal Code Unit In order city Prodi
County Quantity ter unit Region oe
Send evnoil Post Guontiy
" 1 code ;
Galutation Country Price
oe
a atl Address:on prtary Hey: ste ustquely Tewk fy
risen 80 ov Seve! iter, Totes We
> Gvery table need
Ker
eqch vous [esteies +
coonert data from
Trig is Uke a em
diftevent tables. TP you have a unique tdents
te must olusoys have diferent
pecess te
reek _nodar 67 30 we OS primacy Hey. Bul
noes for och POU:
Sometimes you might St too ove vnore Celusans together 05 0 Primary
esite Hey» For eowrtie , on Ovaer delels kobe
‘Te means He Combination
vey , feled 0 Co
aright use oraer sd one THE Product 2D together,
eg ve order $9 Ont ite product 20 wit be dlays sone urque 9 cach
Poe
econ cause Tesues in a databace,
order ruber oF Ovy Sort of 30
vey, TE You owt have a good Cumn Rar Primary Hey
fambtnation of Cunons ab Primary Key OUR com
assigns gulo mati cally. :
> Ustng 6 primary Hey that MOK cheeg
afeen on unique number, Uke OP
sed as 0 petemany
yao Con either rae
ase Rolo Nowber, tikich access
primary Hay vay no Conbian feck but Tes
brat cometimnes
Taentsfication fer each erty,
> Remember
Seu to aasigh & uniave
customers pReowers SUPPLIERS opens
Eupptier TD (PY) ‘Order 20(08)
Gutomer SD (PK) Product 3B(PK)
ese oO coh.
te kobleg You need Wa Hy
Wows you have datded spur inforveation Inte relevan
ng Ue infrwation logetion agin sn montingfil Boys. fr Wok We need fo understod
Teach tao different Fables Ube wie Laenk (e wake
the diferent relationships between
Convection,
yne bo Relation shi
Ce be Many Rewtonsie
yf ttobase design , 0 One-to-Nowy velalionshig Cignifies, 6 Connection between t0
teise tere one record tr the Sick table (one side) Com be assoctated uatth
mutiple veers iw the cezond 4able (the mony side), ut each record Tm Te cecond
ble relates: to only one record in the Second table,
let's tke on exawerle +
Consider 490 tables, "Sugnlie®™ and Products’. A supplier
a oe ghCon have wong Products , but each Product is associated With only one
fs example, ple have many Products 4S Nnpods, Mechook,
Supntier
only one Corplien
iphone 43 pro. but Unese products have
Wotch Series 6,
Vat is Apple. This is Called One—to-Mowy relationchiP. aa
ke
> taken you fivd Such 4 -Mony reationshins ¢———~
D in Suppliers teble)
gy of the one side of We Labbe (sorter a
Gluven ak Ake mony side (Seretier 4D tm Products
> choose primary
avd dl H 0S on additional
teobte)
> Tis adled column
(supntier 9D Sw Sroducts tote)
foresin Key +
jn he movy cide table is called &
“> Tis Foreign key estobtahes & Unk pelioeen two tables,
> Foreign wey should be unique in tie. wary SF
side table. sormen_
[5 Senever- 3 (0)
fe,
Saves wany fo Wan
qroduct , ond a sing
Primacy key values in tht one
Mony 40 Many Relationships
yy relaon
Je Product
Bo produck tee ond order table
> Dh te dotobsse,
single order con hove wnuttirle
—ship. Te rneans a
ler multiple Hme.
Con be ord
weeny
PRopucts. 7
Xiwe 7
se will Comse massive
wo mony in bthich ble we put the foreign Key
;
2 OpDER
Hence,
pedondaney geress a tenons,
> hen you Find Such Mony = Many Relationships: -—=
Crake 0 Bird table, Caled 0S Junction tobe ond ge yoke Combination
+
oh ae Cumans 06 primary Key aa gk He fey Heys ate ene
Corrosive Hey)
> Resign the Primary Heys fo coeh of the original, tobles..
ya the Daneon thle put the foreign key referencing the primary key
af the original fetes:
uwetion table
copped,
conven (PX)One to One Relatfonship
laren each record in one table is associated WIth exectly one necord ts
arothe fable, ond vice-versa.
Foch emnpleyee ew
Eromele po
>
Conployer
Je one employee details +
Employee details
TEnnp 4 fe
geen nates
Year of Deinings Phone number
RE peers aig te
the fevsmnns of the employee abe efers,
uatlable tn Employee details,
ane only
One the chow cos
ts the erectly Some emneyee these Oe
> Dp yaw ever Find AA relationship +
sa Combine the Taformnation ‘nt
to a Sugle tble «
> Tink we ©
g howe the came Subject,
jdecl, Check ig two table:
fp by using the Same
5 BW wok
ime relationsh
‘you con probably Set UP
Primary Fey ia bots og the tnbles
> TY beth table
veys, You con choose
other table's Primed)
oasing, te (Aluran.
‘Refining the Design
> After setting up the table:
tp create ond opulate tes
information , esting queries , hid add
ec hwe different subjects tatth aifterent prtmory
sretiner qf the Ete amd pet Oe
vey foegn Fs Om gat table bY
sg Melde ond relationshies 19 databace. crectat
ec tables With Sample data. Tris al
ng eto reConds
Wows you to
actively ufork WH We *
‘avd amore, By ceing $0 , Potential iss
eps, Fo Rollo S—~
ues Become apparent.
> Recommended St
4. Create ond popviate tables «
cece up your bobles with Fields ond relationchies -
> Populate the tables with Sample data,
2, Testing and Queries
-y Relively work, Wath he information,
y Create queries to retrive seecific data:3. Tdentify Tesues,
create vough drafts of forms ond reronts.
5 Bioluote if they dicrlay extected data
5, Eleminate Duplication
> Look for any unnecessory duplication of dato
> Be Faevti
| adost your dalahose {6 eliwinate redundoney
edivst
6. Piso check,
pees cach cotuvan Contain Fock gbout the table's Subject?
> Does ony ef Your table hes MOY ewply Held 7
> Does any dyisie Coluvan Causing redundancy 40 several Coluvans 2
© Aerlgjng Normalization Rules
ace you hove sek uponr tees ond Tato
tobles ove Gtructured Correctly - his
g, the next step is opplying dete
qormatiztion cules to wave Sore goer
racets cated rormatztion «BE Yrolps ensure that you've organized Your
fefoerotion into the ng Mates.
4. \ahen te Novrnalizet
“ hely worwelizaion onto rules after youve outtined all the information
eames ond ove 0 este design
a. what Te does t
= orwell potion checks if your dake 1s orgprized effectively aceress bles.
i deeswe guarantee hoving, all Khe Correct dots iwitially.
3, How wos +
‘ge roles one after Onathen to achieve Lahat’S called “Nor wel
Bormag "There Oe ive normal forms Widely acopted.
«test: Norwral form (ANF) + Boyce -(add Normal Erm (gene)
+ second Noel RM (28). Fourth ova Fifth Normal Form
+ Third Norwol fr (ne) (aa ond 506)
But we will wnostly use 4nF, 2NE yn
=> Pony