PDA

View Full Version : is better use a SET FIELD data type or use two records and no set field ?


lse123
11-24-2007, 09:26 AM
is better use a SET FIELD data type or use two records and no set field ? I refer for a real estate database table where an apartment block may have 1 or 2 or 3 bedrooms and corresponding prices price1, price2,... etc and try to make a basic search for price beds location type ?

guelphdad
11-24-2007, 03:12 PM
your table should have four columns to describe this (and others if necessary)

column 1 would be the building id. (more information on the building such as address, city etc. belong in the buildings table)

column 2 identifies the unit within the building (apartment number)

column 3 identifies how many bedrooms are in the unit

column 4 identifies the price for the unit

you would have a new row for each unit of every building.

lse123
11-24-2007, 05:28 PM
what if a building has 2 and 3 bedroom with differ sell price ?

guelphdad
11-25-2007, 12:26 AM
then you have two rows in the table.

lse123
11-25-2007, 07:52 AM
may use one row using SET data type ?
how to implement code [mysql/html] so if someone choose "any" for bedroom results to show independence to bedroom column[according ONLY OTHER CRITERIA] ??