I am creating a property search/ comparison website. I require help creating the mysql tables that house the data.
I am unsure how many tables I will need and what I should use for the column headings also.
I want the website to be as precise and complete as possible.
I got the idea to create this website as I am currently looking for a place to live and the search criteria is really simple however the property comparison websites don't have complete/accurate data on the properties of which I'm searching.
I don't know how 'normalised' the tables need to be, for example I could have:
TABLE: properties, FIELDS: id, address_id, bedrooms, bathrooms, garage, garden. TABLE: address, FIELDS: address_id, address_line_1, address_line_2, address_line_3, town, city, postcode.
But then would I need to go into detail about each bedroom within a house and specify its dimensions etc.
If anyone has any suggestions, no matter how small. I would really appreciate it.
For arbitrary properties of the house you could have one table for all.
CREATE TABLE `property_prop` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`properties_id` INT UNSIGNED NOT NULL ,
`name` VARCHAR( 32 ) NOT NULL ,
`value` VARCHAR( 64 ) NOT NULL ,
PRIMARY KEY ( `id` ) ,
INDEX ( `property_id` )
) ENGINE = MYISAM
INSERT INTO property_prop (properties_id,name,value) VALUES (100,'Spacing','100');
INSERT INTO property_prop (properties_id,name,value) VALUES (100,'Rooms','4');
INSERT INTO property_prop (properties_id,name,value) VALUES (100,'Description','This is a nice house. ;)');
//Get a list of all properties for house with id 100.
SELECT name,value FROM property_prop WHERE properties_id=100;