Professional Documents
Culture Documents
Sample Assignment
Sample Assignment
Sample Assignment
Category
has
Product
M
in
Customer
gives
M
Sales Order
Product
Customer
SalesOrder Hdr
Cat_Id (PK)
Cat_Name
Prod_Id (PK)
Prod_Name
Prod_Rate
Prod_UOM
Cat_Id(FK)
Cust_Id (PK)
Cust_Name
Cust_Address
Cust_Email
Cust_Phone
Inv_Id (PK)
Inv_Dt
Cust_Id (FK)
Total Amount
SalesOrder Det
Inv_Id (FK) PK
Prod_Id (FK)
Qty
Item Amount
In the above solution, We have enumerated a few fields only in each table. We
expect detailing as far as possible for the assignment tables.
Relationships between two tables can be 1:1 or 1:M or M:N
When relation is 1:M the primary key of the first table goes into second as foreign
key. Eg: Cat_Id in Product Table or Cust_Id in Sales Order Hdr
When two tables have many to many relation a third table is created where the
primary keys of participating tables are taken as foreign key and together they form
primary key (composite) Eg: Inv_Id and Prod_Id in Sales Order Det Table (Third
Table)