Tuesday 15 July 2014

php - MySQL Database; best schema -


I have a question about a database schema for a specific website where people can sell and buy stuff.

When someone adds an advertisement to the database, then he will select the category and fill the filter related to the selected category, so that by browsing a category of a person and choosing a filter, his ad will be easy You can get:

[Bluetooth] Yes

[camera] 3 - 5 megapixel

AT

What is the best way to save these filters in the database? This is what I have done so far:

This is just an idea, but it will not return the value with the ad for filter "megapixel" between 3 to 5 , Because filter_value type is VARCHAR .

Are you considered to be an additional table with the column ID, filter_id, and value, filter_value_list? This table will contain a list of VARCHAR answers that will be provided as drop down for each filter associated with the category of that ad.

"Bluetooth" filter, possible value will be "yes" and "no". For the "camera" filter, the potential value can be "less than 1 megapixel", "1 or 2 megapixels", "3 to 5 megapixels", "5 to 10 megapixels", "more than 10 megapixels" Is planning for technology).

BENEFITS:

  1. User selects their answer instead of select types.

  2. Unity in all advertisements.

  3. It is possible that the price list can also be used in an "Ad / Filtered filters" sidebar as you can see on many sites these days.


No comments:

Post a Comment