Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Table Organization

Status
Not open for further replies.

FlashMax

Programmer
Dec 30, 2002
42
0
0
US
This is a simple question for seasoned vets, but I am new to database programming.

I have a table for cake orders and a table for cupcake orders. I had to split the two because the table columns are completely different (e.g., I have different requirements for the different orders).

However, I want each order to have a unique order_ID. If the first order was a cake, I want it to be 100; and then if the next order is a cupcake, I want it to be 101, not 100, etc.

I thought about creating an all_orders table that just keeps a running tab of the orders and when a new cake order comes in it adds a new entry into all_orders and puts the order_ID from all_orders into the cake table's order_ID column.

Tables:
cakes
--------
order_ID
amount
type
(etc.)

cupcakes
--------
order_ID
amount
type
(etc.)

all_orders
----------
order_ID
cake_or_cup

Is that the best way to do this?

Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top