I am programming a website that allows users to post ads with detailed fields for the different types of products they sell. However, I have a question about the best database schema.
There are many categories on the site (for example, cars, computers, cameras), and each category of ads has its own fields. For example, cars have attributes such as the number of doors, make, model and horsepower, while computers have attributes such as processor, RAM, motherboard model, etc.
Now, since they are all lists, I was thinking of a polymorphic approach, creating a parent LISTINGS table and another child table for each of the different categories (COMPUTERS, CARS, CAMERAS). Each child table will have a listing_id that will reference a LISTINGS TABLE table. Therefore, when a list is set, it will retrieve a row from LISTINGS joined by a linked row in the linked child table.
LISTINGS
-listing_id
-user_id
-email_address
-date_created
-description
CARS
-car_id
-listing_id
-make
-model
-num_doors
-horsepower
COMPUTERS
-computer_id
-listing_id
-cpu
-ram
-motherboard_model
So, is this design a good design pattern or are there any better ways to do this?
, , , - , , . , 100 , ?
, (-), , , ?
, ?