How can several different datatypes be saved in one table
- by poseidon
This is my situation: I am constructing an ad-like application in Django and Mysql. I am using a flexible-ad approach where we have:
a table with ad categories (several categories such as home, furniture, cars, etc.)
id_category
name
a table with details for the ad categories (home: area, squared meters. car: seats, color.)
id_detail
id_category (the categ the detail describes)
name
type (boolean, char, int, long, etc.)
the ad table (i am selling a house. i am selling a car.)
id_ad
id_category
text
date
a table where i plan to consolidate the details of the ads (home: A-area, 500 sq-meters. car: 5 seats, red.)
id_detail_ad
id_ad
id_detail
value
Is this possible? Can I have a table of details for all the ads, even if details include numbers, texts, booleans, etc? Or would I have to save them all as text and then interpret them via code accordingly? Please express your opinions. Thank you.