You are on page 1of 8

Exercise 2.

4)

An aging shoe manufacturing company has decided to abandon the highly


competitive market for low-cost mass-market shoes. Instead, it wants to have
Customers order custom shoes that will be made on demand. Customers will trace or
scan their feet and molds will be built specifically for each Customers . The foot
information will be digitized and stored in the database so it can be retrieved and used
whenever the Customers orders shoes. The firm will produce a variety of standard
styles of shoes. Customers will select a style, choose a color and size, and in many
cases choose a material. The orders are sent to company factories that Customize the
shoe to each person. Customers can also specify minor adjustments to most shoes
such as asking for slightly wider shoes for certain tasks. The basic information is
entered on the sample form, but the company needs everything in a database. Create
the normalized tables for this case.

*******

‫ كويس و‬Scenario ‫ محتاج إنكم تقروا الـ‬.. Form ‫ و‬Scenario ‫ معطينا‬.. ‫مثل ما انتو ملحظين في السؤال‬
‫ و نقارن بينه‬.. ‫ و تشوفوا إذا تقدروا تحسنوا شي فيه‬Form ‫ بعدين تروحوا للـ‬.. ‫تركزوا على التفاصيل اللي فيه‬
..!‫ إذا كان كل البيانات موجودة فيه ول في شي ناقص؟‬.. ‫ المعطى‬Scenario ‫و بين‬

‫كم جدول تتوقعوا حيكون عندنا ؟؟؟‬

‫ و تتضمن كل التفاصيل اللي‬Normalized tables ‫ إنها تكون‬.. ‫أهم شي عندنا لما نجي نعمل الجداول‬
Scenario ‫موجودة في الـ‬

----------
‫و عندنا في تعريف النورمليزيشن ‪..‬‬
‫‪The process of creating a well-behaved set of tables to efficiently store data,minimize‬‬
‫‪redundancy,and ensure data integrity‬‬

‫و هذا معناهـ إني محتاجة إني أقسم الـ ‪ entities‬في جداول صغيرة قد ما أقدر ‪..‬‬

‫‪----------‬‬

‫‪ ..‬نرجع تاني للسؤال حقنا ‪ ..‬و نشوف هو إيش معطينا ‪ ..‬عشان نبدأ نعمل النورمليزيشن ‪-‬‬
‫‪1- All Attributes are listed bellow‬‬

‫رقم الطلب ‪- OrderID‬‬


‫تاريخ الطلب ‪- OrderDate‬‬
‫التاريخ المتوقع للشحن ‪- EstimatedShipDate‬‬
‫تاريخ الشحن الفعلي ‪- ActualShipDate‬‬
‫تكاليف الشحن ‪- ShippingCost‬‬
‫‪-----------‬‬
‫السم الخير للعميل ‪- CustLastname‬‬
‫السم الول للعميل ‪- CustFirstName‬‬
‫التليفون ‪- Phone‬‬
‫البريد اللكتروني ‪- Email‬‬
‫العنوان ‪- Address‬‬
‫المدينة ‪- City‬‬
‫الولية ‪- State‬‬
‫الرمز البريدي ‪- PostalCode‬‬
‫البلد ‪- Cournty‬‬
‫رقم تعريف للقدم اليسرى ‪- LeftFoodID‬‬
‫رقم تعريف للقدم اليمنى ‪- RightFootID‬‬
‫ملحظات ‪- Comments‬‬
‫‪-----------‬‬
‫عنوان الشحن ‪- ShippingAddress‬‬
‫المدينة ‪- City‬‬
‫الولية ‪- State‬‬
‫الرمز البريدي ‪- PostalCode‬‬
‫البلد ‪- Country‬‬

‫‪-----------‬‬
‫رقم موديل الحذاء ‪- ShoeStyleID‬‬
‫الوصف ‪- Des-cri-ption‬‬
‫اللون ‪- Color‬‬
‫الخامة ‪- Material‬‬
‫المقاس ‪-Size‬‬
‫التعديلت المطلوبة ‪- Adjustments‬‬
‫السعر ‪- Price‬‬
‫‪-----------‬‬
2- we know that in Normalization we use this Format:

TableName(Primarykey, attribute, attribute, attribute(REPEATED ATTRiputes)) O

-----------
UnNormalizedForm ‫ نقدر نكتب الـ‬Form ‫من هذا الـ‬

‫ مع ملحظة وضع الـ‬Primary Key ‫ و اختيار‬Form ‫ اللي في الـ‬Attributes ‫و هو عبارة عن جميع الـ‬
: ‫ مثل ماهو موضح في السفل‬.. ‫ خاص فيها‬Primary Key ‫ المتكررة بين قوسين و اختيار‬Attribute

UNNORMALIZATION FORM
OrderForm1(OrderID , OrderDate, EstimatedShipDate, ActualShipDate,
ShippingCost, CustID, CusLastName, CustFirstName, Phone, Email, Address, City,
State, PostalCode, Country, LeftFootID, RightFootID, ShippingAddress,
(ShoesStyleID, DeS-CRI-PTion, Color, Material, Size, Adjustment, Price) ) O

*********************
FIRST NORMALIZATION FORM
First normal form (1NF) : A table is in 1NF when there are no repeating groups
within it.Each cell can contain only one value.For example,how may items can be
placed in one Order table?The items repeat,so they must be split into a separate table.

First Normal Form ‫عشان نوصل للشكل الطبيعي الول‬

.. ‫ المكررة‬Attributes ‫ لزم نفصل الـ‬-1


‫ الخاص بالمجموعات المتكررة و‬Primarry Key ‫ الساسي اللي عندنا مع الـ‬Primary Key ‫ نضيف الـ‬-2
Composite key ‫بهذي الحالة حيصير عندنا‬

3-

OrderForm1(OrderID , OrderDate, EstimatedShipDate, ActualShipDate,


ShippingCost, CustID, CusLastName, CustFirstName, Phone, Email, Address, City,
State, PostalCode, Country, LeftFootID, RightFootID, ShippingAddress) O

Item(OrderID, ShoesStyleID, DES-CRI-PTion, Color, Material, Size, Adjustment,


Price) O

*********************
SECOND NORMALIZATION
Second normal form (2NF) : A table is in 2NF if every nonkey column depends on
the entire key (not just part of it).This issue arises only if there is a concatenated
key(with multiple columns).
Second Normal Form ‫عشان نوصل للـ‬

1- ‫ نشوف‬:

Item(OrderID, ShoesStyleID, DeS-CRI-PTion, Color, Material, Size, Adjustment,


Price) O

‫ اللي ما نقدر‬NonKeys ‫ إيش الـ‬.. ‫ الباقية‬NonKeys ‫ و الـ‬Composite Key ‫ و نخلي تركيزنا على الـ‬-2
‫ اللي تعتمد على‬NonKeys ‫ مع بعض ؟ و إيش الـ‬Compisite Key ‫نحصل عليها غير إذا كان عندنا الـ‬
‫ فقط ؟؟‬ShoesStyleID ‫ اللي تعتمد على‬NonKeys ‫ فقط و إيش الـ‬OrderID

‫ فقط مالها‬ShoesStyleId ‫كلها تعتمد على‬DeS-CRI-PTion, Color, Material, Size, Price ‫ ال‬-3
: ‫ على النحو التالي‬Style ‫ إذن حيكون عندنا جدول اسمه‬OrderId ‫علقة بالـ‬

Style( ShoesStyleID, DeS-CRI-PTion, Color, Material, Size, Price) O

‫ ما نقدر نعرف ايش التعديلت اللي يبغاها العميل ال إذا‬.. ‫ و مثل ما تعرفوا‬Adjustment ‫ بقي عندنا الـ‬-4
: ‫ على النحو التالي‬OrderItem ‫ إذن حيكون عندنا جدول كمان اسمه‬.. ‫عرفنا رقم الطلب و رقم الموديل‬

OrderItem (OrderID, ShoesStyleID, Adjustment) O

: ‫ مثل ما هو‬First Normal Form ‫ و ننزل الجدول الثالث اللي عندنا من الـ‬-5

OrderForm1(OrderID , OrderDate, EstimatedShipDate, ActualShipDate,


ShippingCost, CustID, CusLastName, CustFirstName, Phone, Email, Address, City,
State, PostalCode, Country, LeftFootID, RightFootID, ShippingAddress) O

-*-*-*-*-*-*-
‫ و بكذا حيكون عندنا خلصة الـ‬Second Normal Form ‫ثلث جداول‬
:
Style( ShoesStyleID, DeS-CRI-PTion, Color, Material, Size, Price) O

OrderItem (OrderID, ShoesStyleID, Adjustment) O

OrderForm1(OrderID , OrderDate, EstimatedShipDate, ActualShipDate,


ShippingCost, CustID, CusLastName, CustFirstName, Phone, Email, Address, City,
State, PostalCode, Country, LeftFootID, RightFootID, ShippingAddress) O

*********************
THIRD NORMALIZATION
Third normal form (3NF) : A table is in third normal form (3NF)if each nonkey
column depends on the whole key and nothing but the key.

Third Normal Form ‫عشان نوصل للـ‬

‫ اللي عندنا اللي هو‬Primary Key ‫ اللي ما تعتمد على الـ‬NonKeys ‫ الـ‬OrderForm1 ‫ حنشوف جدول‬-1
.. ‫ و نفصلها في جدول مستقل‬OrderID

-2
OrderForm1(OrderID , OrderDate, EstimatedShipDate, ActualShipDate,
ShippingCost, CustID, CusLastName, CustFirstName, Phone, Email, Address, City,
State, PostalCode, Country, LeftFootID, RightFootID, ShippingAddress) O

‫ و قسم يعتمد على الـ‬OrderID ‫ قسم يعتمد على‬.. ‫ أقسام‬3 ‫ قسمتها إلى‬attributes ‫ لو لحظتوا كيف لونت الـ‬-3
City ‫ و قسم خاص بالـ‬Cus-tum-er

‫ خمس‬Third Normal Form ‫ و بكذا حيكون عندنا خلصة الـ‬-4


: ‫جداول‬
Order (OrderID , OrderDate, EstimatedShipDate, ActualShipDate, ShippingCost,
ShippingAddress) o

Cus-tum-er (CustID, CusLastName, CustFirstName, Phone, Email, Address,


LeftFootID, RightFootID) o

City (CityID, State, PostalCode, Country) o

Style( ShoesStyleID, Des-dri-ption, Color, Material, Size, Price) o

OrderItem (OrderID, ShoesStyleID, Adjustment) o


*********************

*********************

..

You might also like