That is where I am at. Which is better to use. Only need space for 4 drives with the computers I currently use, but what if I purchase a server that takes 16, and what other things might the future hold?
I think I will be better off having the drives separate and just match the drives with the computer they are installed in. I know I am answering my own question here, but it makes me feel more comfortable knowing that others come up with the same solutions I do. Thanks. > From: "Peter Lovatt" <[EMAIL PROTECTED]> > Date: Sun, 23 Jun 2002 22:24:32 +0100 > To: "Mike Tuller" <[EMAIL PROTECTED]>, "Chris Barnes" > <[EMAIL PROTECTED]>, "Php-Db (E-mail)" <[EMAIL PROTECTED]> > Subject: RE: [PHP-DB] Question > > Hi > > The correct way, IMHO, would be to consider the situation. The hard drives > are a sub component of the computer. In which case the hard drive table > should be a 'child' of the computer table. > > However the hard drives could be an item in their own right too. > > So if you want to consider the hard drive as an item, but to know which > computer it is in then make HardDriveID the primary key of the hard drive > table, and include ComputerID as a link field. > > If it is basically a component of the computer then make > (ComputerID,HardDriveID) the primary key. > > In practice either will work as will > > Computer table > { > ComputerID(primary) > Hard_drive_1 > Hard_drive_2 > Hard_drive_3 > ...... > Hard_drive_n > > } > > which is simpler, not good design, but probably OK if you are sure you will > never have more than 'n' drives > > just my 2p worth > > Peter > ----------------------------------------------- > Excellence in internet and open source software > ----------------------------------------------- > Sunmaia > www.sunmaia.net > [EMAIL PROTECTED] > tel. 0121-242-1473 > ----------------------------------------------- > >> -----Original Message----- >> From: Mike Tuller [mailto:[EMAIL PROTECTED]] >> Sent: 23 June 2002 21:07 >> To: Chris Barnes; Php-Db (E-mail) >> Subject: Re: [PHP-DB] Question >> >> >> That would probably work, but only for what I want right now. If I ever >> wanted to create a report of all the hard drives I have, it would become >> more difficult. >> >> I know I need to have a separate table in the database for the drives, but >> am not sure if the foreign key should be drives in the computer table, or >> computer in the drive table. I could just go ahead and work with it, but I >> am the type that wants to learn the right way in the beginning, not figure >> out later that I was doing it wrong. As far as normalization, > >> In reply to >> Duncan's post) I have been reading up on that, and so far it >> hasn't given me >> the answer on this type of problem. Maybe what I am reading doesn't cover >> that, so if you are talking about a particular document, let me know and I >> will look at that. >> >>> From: "Chris Barnes" <[EMAIL PROTECTED]> >>> Date: Mon, 24 Jun 2002 05:03:53 +1000 >>> To: "Php-Db \(E-mail\)" <[EMAIL PROTECTED]> >>> Subject: RE: [PHP-DB] Question >>> >>> i dont know how will this will work, but you could try storing >> the multiple >>> hard disk details for each computer in an "array" in 1 field. >>> then when you want to get the information from the db, use explode() to >>> store the value in the field into an array again. >>> >>> e.g. >>> the field in the DB might look like this... >>> HardDriveSize = "1.2Gb,25Gb,25Gb" >>> >>> so get the field from the db and then use explode() to store it >> in an array >>> in php. >>> e.g. >>> $disk_size = explode("," , $field); >>> >>> i dont know how well this will work for you...i'm only a newbie. >>> >>> >>> -----Original Message----- >>> From: Mike Tuller [mailto:[EMAIL PROTECTED]] >>> Sent: Monday, 24 June 2002 3:43 AM >>> To: [EMAIL PROTECTED] >>> Subject: [PHP-DB] Question >>> >>> >>> I am wanting to create a PHP frontend to a database that holds >> information >>> about the computers that I take care of. I have a problem though when it >>> comes to storing hard drive information. In most cases, the >> computers have >>> one drive, but some have 2 or more, so I can't create the main >> database with >>> fields like this. >>> >>> ComputerID >>> HardDriveType >>> HardDriveSize >>> >>> I know I will need to create a separate table to hold >> information about the >>> drives, and connect them to the computer by attaching the >> primary key of the >>> drives table to the Computer table. >>> >>> Computer Table >>> >>> ComputerID >>> DriveID >>> ------------------------ >>> Drive Table >>> >>> DriveID >>> HardDriveType >>> HardDriveSize >>> >>> This is where I am unsure. If there is more than one drive, >> then this would >>> be incomplete because it would only show one drive. What is the >> best way to >>> make it so that all drives show for the computer, or am I doing this >>> backwards? Should I tie the computer to the drive instead? >>> >>> Thanks, >>> Mike >>> >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> -- >> PHP Database Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php