The site is supposed to post ads. All ads are divided into various categories (roughly as Avito).
To create a form is filled with the fields "name", "description" (typical for all ads) and the choice of categories. After selecting a certain category, an additional form with data is loaded (for example, for cars - color, mileage, etc., for real estate - the floor, house type, number of apartments, etc.).
Supposedly in the database there will be a common table for all Adverts ads:
id | name | description | category | type in which the name, description of the advertisement and category id are stored, corresponding to the category in the table selected by the user and the type field to be divided into more detailed tables with data on the announcements. Those. for each form of the announcement there is a table, for example:
Adverts
23 | Продам машину | "описание" | 4 | auto AdvertAuto
id | color| mileage | model 1 | red | 280000 | honda The question arises, how to dock the data? It is clear that in the case of a single announcement, it is enough to simply press the desired table, but what to do when the selection is performed on all the ads?
It becomes necessary to join many tables at once, depending on the value of the type field.
Actually questions:
1) Is this architecture correct and are there any better solutions?
2) If this architecture is correct, then how to select multiple values? I saw requests using CASE - WHEN - THEN or with JOIN UNION, but how suitable are these requests for living on the combat server?