Hey everybody,

I'm new to mysql, but I'm developing a real estate website, mostly for condos. I'm setting up the database and want to make sure it's sufficiently designed so that customers can search the database for the type of place they want.

Specifically, if someone wants to search for the number of rooms in the condo. Some properties have a range of rooms, so they will have 1, 2, and 3 bedroom condos available, and I want them to be able to search for price related to those properties, and obviously the prices for each condo would be different based on the number of rooms, even if they're in the same property.

Would it be wise to setup the database so that each property has a different database entry for the number of rooms (i.e. one entry for condo company, 1 bedroom, $200,000 | one entry for condo company, 2 bedrooms, $300,000) OR should I do one entry for the property and separate columns for 1 bedroom, 1 bedroom price, 2 bedroom, 2 bedroom price, etc.?

Any help would be much appreciated.

Thanks!

Recommended Answers

All 2 Replies

Not sure you mean by 'entry'. But your first choice seems about right.

You will want a table with the following fields:
ID
Company
# bedrooms
Price

Then a user could select from your db where company=x AND #bedrooms = y AND price <= z

Of course if you want to be able to search for more criteria you will have to incorporate them.

Not sure you mean by 'entry'. But your first choice seems about right.

You will want a table with the following fields:
ID
Company
# bedrooms
Price

Then a user could select from your db where company=x AND #bedrooms = y AND price <= z

Of course if you want to be able to search for more criteria you will have to incorporate them.

trudge is right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.