floridaflatlander Posted February 27, 2013 Share Posted February 27, 2013 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 Quote Link to comment Share on other sites More sharing options...
Barand Posted February 27, 2013 Share Posted February 27, 2013 you may want to look at a structure like this one by Jessica http://forums.phpfreaks.com/topic/274976-best-way-to-deal-with-item-with-different-sizes-available/?do=findComment&comment=1415128 Quote Link to comment Share on other sites More sharing options...
davidannis Posted February 28, 2013 Share Posted February 28, 2013 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. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted March 1, 2013 Share Posted March 1, 2013 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. Quote Link to comment Share on other sites More sharing options...
davidannis Posted March 2, 2013 Share Posted March 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.