Welcome Guest, Not a member yet? Register   Sign In
MySQL Table design
#9

[eluser]peterbz[/eluser]
I just did some research and found out this style is called EAV (Entity Attribute Value). Apparently, there are 2 schools of thoughts: one that frowns upon it since it is an anti-pattern, and others who use it because their requirements are unclear or are always changing.

What I'm deciding to do in the end is adapting the inheritance model.

Since all 3 of these "Categories" all are listings, I can essentially create an class Listing and the 3 Categories (auto parts, cars, wheels) can extend from this class. In essence, I can create a table Listing that has all the similar attributes (title, user_posted, etc) and create 3 other tables wheels, cars, auto parts (each with their respective attributes PLUS a listing_id to link back to the listing table). In this way, if I need other foreign keys such as table Images that needs to be linked to the original listing, I can just link it with listing_id instead of have 3 different foreign keys or 3 different tables for Images.


Messages In This Thread
MySQL Table design - by El Forum - 03-30-2009, 04:24 PM
MySQL Table design - by El Forum - 03-30-2009, 04:41 PM
MySQL Table design - by El Forum - 03-30-2009, 05:05 PM
MySQL Table design - by El Forum - 03-30-2009, 07:16 PM
MySQL Table design - by El Forum - 03-30-2009, 07:32 PM
MySQL Table design - by El Forum - 03-30-2009, 07:34 PM
MySQL Table design - by El Forum - 03-30-2009, 08:35 PM
MySQL Table design - by El Forum - 03-31-2009, 05:24 AM
MySQL Table design - by El Forum - 03-31-2009, 07:53 AM
MySQL Table design - by El Forum - 03-31-2009, 08:04 AM
MySQL Table design - by El Forum - 03-31-2009, 11:59 AM
MySQL Table design - by El Forum - 03-31-2009, 10:01 PM
MySQL Table design - by El Forum - 03-31-2009, 10:04 PM
MySQL Table design - by El Forum - 03-31-2009, 10:34 PM
MySQL Table design - by El Forum - 04-01-2009, 07:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB