Jump to content

Reusing columns for different items


floridaflatlander

Recommended Posts

I have a mysql table of items and was wondering if it would be to confusing to combine the columns used for the different “non-repeating info” that items had.

 

Instead of having columns for the number of bathrooms, boat length, rv length and camper length have one column called something like num1.

 

I've always heard that you should name columns in a way that associates with the column info, but if I combine columns I just have to add 18 columns, if I don't combine them I have to add 50 plus columns.

 

Or .. even though the data is non repeating go ahead and make tables for the info for realestate, boats, autos, rv's and on and on.

 

Just looking for some ideas

Thanks

Link to comment
Share on other sites

It seems to me you could keep it in a single table with fewer columns if you think of your data a bit differently. Example:

 

Column       Object Type     Number of Baths     Length

Records

                      Car                    0                             9

                      RV                      1                             30

                      Boat                    2                          120

 

No reason to think of car length, boat length, and rv length as different types of data unless I misunderstand.

Link to comment
Share on other sites

Baths, in a car? That makes no sense.

Also, what if you wanted to add the mast height of sailboats, or the tire dimensions for the cars? You'd end up with an unholy mess of fields, most of which makes no sense to have in any one of the rows.

 

No, do what Barand and Jessica suggested, and use a proper database design for this.

Link to comment
Share on other sites

Of course, Christian is right - mast height or number of wheels doesn't fit into a single table. I wasn't thinking clearly there. However, I still thinnk that car length, boat length, and vehicle length shoudl be generalized to vehicle lenght.

 

Appologies for the poorly thought out post.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.