|
|
| Author |
Message |
| Gazdaman |
This post is not being displayed .
|
 Gazdaman I did a trackday!!!

Joined: 12 Aug 2004 Karma :    
|
 Posted: 03:33 - 18 Aug 2006 Post subject: Database query |
 |
|
Ok, say I've got a table called Orders. I have a field for ProductID, which is linked to another database (yes we're talking relational here people).
I want to have space for at least 10 different productIDs in my order table. Does that mean I need 10 fields, Prod1ID, Prod2ID.
Or is there another, simpler way that I'm just missing.
I realise my explaining isn't exactly spot on. Just if someone orders one product, that means I have 9 fields left blank.
It's like, if you build a small house, you'd only build it on a small piece of land, you wouldn't build a tiny house on a massive plot of land. I just think I'm missing something by reserving all this space in case someone orders 10 different things.
This is for a piece of coursework btw, it's all theoretical, there is no datebase (or spoon?) at the moment it's just an entity relationship diagram. I don't think I can make the entity expand to accomodate the information being given to it. Like as it stands I've defined the boundaries, and if it's not used, it just lays blank.
Anyone have any input? Strange subject I know.
Gaz |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Kickstart |
This post is not being displayed .
|
 Kickstart The Oracle

Joined: 04 Feb 2002 Karma :     
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Jesus_Christ |
This post is not being displayed .
|
 Jesus_Christ Spanner Monkey

Joined: 25 Jul 2006 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| feef |
This post is not being displayed .
|
 feef Energiser Bunny

Joined: 11 Feb 2002 Karma :   
|
 Posted: 10:35 - 18 Aug 2006 Post subject: |
 |
|
why not have an order ID as well as a uniqe ID in the order table. and th then use a composite primary key. That way you can have multiple records per order, rather than requiring multiple columns for a single order row.
I'm assuming MySQL for the DDI...
CREATE TABLE `order` (
`ID` int(11) NOT NULL auto_increment,
`OrderID` varchar(25) NOT NULL default '',
`ProdID` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`,`OrderID`)
) TYPE=InnoDB; ____________________ Mudskipper wrote: feef, that is such a beautiful post that it gave me a lady tingle
Windchill calculator - London Bike parking
Blog and stuff - PlentyMoreFish dating |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Gazdaman |
This post is not being displayed .
|
 Gazdaman I did a trackday!!!

Joined: 12 Aug 2004 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| feef |
This post is not being displayed .
|
 feef Energiser Bunny

Joined: 11 Feb 2002 Karma :   
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Marci |
This post is not being displayed .
|
 Marci Brolly Dolly

Joined: 01 Sep 2005 Karma :   
|
 Posted: 13:07 - 18 Aug 2006 Post subject: |
 |
|
If you want to look at an existing database that's similar to what you're after, head to www.actinic.co.uk, download their free trial and install. Head to c:\program files\actinic ecommerce v7\sites\site1 and open actinicmaster.mdb (i think)...
That's a complete predone system that runs off an Access-based backend via a custom gui... you can see all the various tables for the various stages of order processing etc. ____________________ FAB-Racing MiniMotoSidecars - Back with a vengeance - F1 Class 2011...
CBR170 engine, custom chassis - www.minimotoscene.co.uk |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| veeeffarr |
This post is not being displayed .
|
 veeeffarr Super Spammer
Joined: 22 Jul 2004 Karma :     
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
Old Thread Alert!
The last post was made 20 years, 43 days ago. Instead of replying here, would creating a new thread be more useful? |
 |
|
|