If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Is this Database Design order system

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-05-08, 15:10
bakhtn bakhtn is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Is this Database Design order system

is this ok, just thinking if I can make any improvements on it, or can anyone forsee or predict any problems that may occur with the database design for a simple restaurant order system.

TYPE ( typeName* , typeUnique )

ITEM ( itemID* , typeName , itemName, itemAvailableSizes, itemAvailablePrices)

ORDER_ITEM ( orderItemID*, orderNo , itemID , orderItemQty, orderItemSize, orderItemPrice)

ORDER ( orderNo* , customerID , orderTime, orderDate, readyFor, timeGiven, subTotal, discount, grandTotal, cashTendered, changeDue, orderType, NumberOfItems)

CUSTOMER ( customerID* , name, phoneNo, address, postcode )
Reply With Quote
  #2 (permalink)  
Old 03-05-08, 17:06
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Quote:
Originally Posted by bakhtn
TYPE ( typeName* , typeUnique )
I guess that the asterisk indicates a primary key... So what's the other field?

Is there any need for you to prefix fields in the orders table with the word "order"?

Order date and order time appear to be separated... What datatype were you going to use for each field? Generally a single datetime field should sort you out. Do you need to store the grand total, considering it is just a calculation based on the other information available to you? Some may consider this redundant.

Same goes for number of items.

What's an order type? Are you using the same type table for both item and order types?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 03-05-08, 18:19
bakhtn bakhtn is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
yes * is primary key, yeah I got the prefix part, i was in a rush thats why i didnt prefix it. Not in terms of syntax, but is it correct as a relational database.
Reply With Quote
  #4 (permalink)  
Old 03-05-08, 18:22
bakhtn bakhtn is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
orderType can have one of two values, pick-up or delivery. type table has type, meaning Drinks, Main Meals, desserts.
Reply With Quote
  #5 (permalink)  
Old 03-06-08, 03:48
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
what you may consider changing is the orderitme tabels

they are a couple of things you can looks at.. does the homework assignment allow the same product to be ordered more than once... if not make porderid & productID the primary key

alternativley you coudl ook at having orderitemno as an intger or byte filed ranging from 1......whatever.. and make orderIF & itemNo the PK.

I wouldn't normally expect order time and order date separate items.. but I suppose it depends on the db this is being implemented in, most dbs these days seem to support a composite date and time datatype

I don't think you need numberofitems, as it can be derived from the orderitems table

I can't see any table identifying products

but on the whole looks OK for now
Reply With Quote
  #6 (permalink)  
Old 03-06-08, 09:50
bakhtn bakhtn is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
item table is equivalent to a product table. yes I just used a very bad name lol. yes item holds data of a product i.e. price etc.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On