Which tables to create and with what fields?

qadeer37

Well-known member
Joined
May 1, 2010
Messages
63
Location
Hyderabad,pakistan
Programming Experience
1-3
Hi,

I want to make database for a shop where a customer order's for a product.

So I assume there must be three tables for it with following fields.

1-customer
CID
Name
Email
Balance

2-order
OID
PID
?
?

3-product
PID
Name
Price

What else should an order table have and what should be relationship between them.
:confused:
 
ummm ERD diagrams delicious.

Ok, my database stuff is very rough, however i'll attempt to help you:


Customer
^^^^^^
CustomerID - PK
CustName
CustAddress
CustCity
CustTown
CustEmail


Order
^^^
CustomerID - FK
OrderID - FK
orderDate


Order Items
^^^^^^^
orderID - PK
itemID - PK
itemQuantity


Items
^^^^
itemID (PK)
itemDescription
itemPrice


your assignment also mentions you need the relationships, here:

1TM - 1 to many


Customers - 1TM -> Orders - > 1TM order_items - MT1 <- Items

In english:

a customer can have ONE or MANY orders
an order can contain ONE or MANY order Items
order items can contain ONE or MANY items

At the top of the assignment, feel free to fill the name is as mine. :)
 
If youre more comfortable doing it in .net then make a class for everything (which becomes a row in a table), and where you have a collection of a class, that is a separate table with an id to link
 
Back
Top