Table တစ်ခုတည်းထဲမှာ customer name, order, product info အားလုံး ထည့်ထားရင် customer တစ်ယောက် order ၁၀ ကြိမ်ဝယ်ရင် customer name ကို ၁၀ ကြိမ် ထပ်ရေးရမှာပါ — data ထပ်တာက storage waste ရုံမက, name ပြောင်းရင် row ၁၀ ခုလုံး update ရမယ့် ပြဿနာလည်း ဖြစ်ပါတယ်။ Normalization က ဒီပြဿနာကို ဖြေရှင်းပေးတဲ့ table design technique ပါ။
Normalization ရဲ့ အခြေခံ idea
Normalization ရဲ့ core idea က data တစ်ခုစီကို 'တစ်နေရာတည်း' (single source of truth) သိမ်းထားဖို့ပါ — customer info ကို customers table မှာသိမ်း, order info ကို orders table မှာသိမ်း, ပြီးမှ orders table ထဲက customer_id column ဖြင့် customers table ကို reference (foreign key) လုပ်ပါတယ်။ Customer name ပြောင်းချင်ရင် customers table ထဲက row တစ်ကြောင်းပဲ update ရုံပါ။
| Normalization မလုပ်ရသေး | Normalization လုပ်ပြီး |
|---|---|
| Table 1 ထဲ data အားလုံး ရော | Table များစွာ, relationship ရှင်းလင်း |
| Customer name ထပ်ခါထပ်ခါ ရေး | Customer name တစ်နေရာတည်း သိမ်း |
| Update ရင် row များစွာ ပြောင်းရ | Update ရင် row တစ်ကြောင်းပဲ ပြောင်း |
လက်တွေ့ ဘယ်လိုစဉ်းစားရမလဲ
Table ဒီဇိုင်းရေးတဲ့အခါ 'ဒီ column ကို row များစွာမှာ ထပ်ရေးနေရလား' လို့ မေးကြည့်ပါ — ဖြေက 'ဟုတ်တယ်' ဆိုရင် table ခွဲပြီး foreign key ဖြင့် ချိတ်ဆက်ဖို့ စဉ်းစားသင့်ပါတယ်။ Over-normalization (table အလွန်များစွာ ခွဲထား) ကလည်း query complexity ကို တိုးစေတတ်ပါတယ် — real-world project တွေမှာ 'ရုံရုံနှင့်တင်' (practical balance) ကို ရှာရပါတယ်။
အနှစ်ချုပ်
Normalization က SQL table ဒီဇိုင်းရေးတဲ့အခါ data ထပ်နေခြင်းနဲ့ update anomaly ကို ရှောင်ရှားပေးတဲ့ technique ပါ — 'data တစ်ခုစီကို တစ်နေရာတည်း သိမ်း, foreign key နဲ့ ချိတ်' ဆိုတဲ့ core idea တစ်ခုတည်းနဲ့ စတင်နိုင်ပါတယ်။
