Ok, so I am carrying out a rather simple task as part of a job requiretement. Here is the task in a nutshell:
- Design a form for creating ad for selling car
Form has 2 have:
- 2 drop downs:
- Car make
- Car model (car model has to be dynamic, based on selected model
- textaera for short description
- Atleast 10 checkboxes with various properties (air con, electric windows etc)
- 2 drop downs:
Database has to be implemented in a way, so it is easy to search
Here is EER for the design I have at the moment:
And for those that prefer SQL, you can find it here
So couple points I want to ask:
Initially I have thought to only have reference to "car_model" in "posts" table. Cause technically I could access the car make via the "car_model" table. But then decided that for search purposes it would be easier to have both keys in this table, correct decision?
Another point, is with properties. Obviously this is a many to many relationship (many posts, can have many properties), so a relationship table is an obvious choice. But as far as searching goes, this complicates a bit, cause now for example I am searching for particular model, with particular properties I need to look up 2 tables. Is there better way? I was thinking to have an extra "text" field in the "post" table with comma separated list with all property ids, and use a `LIKE %property%" query (in addition to the relationships table). Any better solution?
And finally, just in general, any other suggestions given the specification?
Both answer's really good an helpful, but accepted the xuma202 answer, as he needs some of that sweet rep points more at the moment :D