structure question
I Have a realtional db i am putting together, with the help of members here i have most of it done.. thank you everyone. however i am stuck on how to do one last part.
its for tracking cell phone line sales inhouse.
so each customer can have multiple orders each order can have multiple lines each line has one plan attached to it each line can have multiple addons (hotspot service, insurnace etc)
i have everything done except i am having issues with teh multiple addon services.
I have a TBL Lines with the following structure
ID_Key
Phone-Num
Customer_FK (Foreign Key to customer table)
Plan_FK (Foreign key to Plan Type Table)
Serial_Number
Order_FK (Foreign Key to Order_Details Table)
I was then thinking of adding in another field called
Service_FK (Foreign Key to a table that is made up of the following)
TblServiceOrder
SeriviceID (References TblServiceType)
LineID (references ID_KEY from TBl Lines)
The Tbl Service Type is a table with just
ID (Primary Key)
Description
Eg. --> ID 132 -->Insurance ID 133 --> Hotspot
Am I heading开发者_如何学C down the right path ?
I will want to be able to pull a report on the details of each order . e.g.
Customer: 1234 Orders 2 Lines, Line 1 has plan 103, Line 2 has plan 104. Line 1 also has Insruance and has a hotspot added, Line 2 just has insurance.
thanks for all your help
Pat
There's no reason to add a Service_FK
field to the Lines
table. The relationship is already expressed by the new table having the LineID
in it.
精彩评论