DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Database Design (http://www.daniweb.com/forums/forum142.html)
-   -   need help with table design (http://www.daniweb.com/forums/thread200192.html)

LeonKamei Jun 27th, 2009 12:12 pm
need help with table design
 
I have 2 kinds of units that can be leased, trucks and heavy equipments. Each of them has it's own attributes, so i create 2 tables for them.

Then i have Order_Details table which stores the Order key and the unit key.

I'm confused as how to connect the trucks and heavy equipments table with the Order_Details table. I really want to use one ID for both kinds of units. Or do i need to have two Order_Details tables each for the truck and the heavy equipment? Or maybe there are better solutions?

Thx in advance.

Phaelax Jul 6th, 2009 1:38 pm
Re: need help with table design
 
I would probably create a single table for Units and give a unique ID to each truck and equipment. The ID would be a SKU built from a pre-defined set of rules describing how it's formed. For example, every truck ID would be prefixed with a T, and equipment could all begin with E. This would simplify your orderDetails table because then you could reference a single ID regardless of the type of Unit being leased. I would likely use a separate table then to store Unit attributes.


All times are GMT -4. The time now is 12:08 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC