One or two tables

I’m working on a real estate website. Beside of the regular fields for a property (bedrooms, bathrooms, price etc) there are a lot of additional fields for every property required (floors, plot_size, covered_area, parking, etc etc) Would it be best to have a separate table for these details or should I keep it all in one table?


If the fields occur once per property then put them in the same table. If you might need more than one value for a field for the same property then make it a separate table.

donboe, if you’re asking about whether to put the additional columns into the same table or set up a generic table to handle unknown columns, such as this –

[COLOR="Blue"]property attribute     value[/COLOR]
   114   floors        5
   114   plot size     50'x700'
   114   sauna         yes
   133   solar panels  10kW

then the answer is yes, you can do that, as long as you are aware of the complexities of the SQL you might need if searching for combinations of these additional attributes



Thanks Stephen and Rudy. That makes very much sense indeed! The search functionality won’t include these additional fields, So I will use a generic table.