Database design Questions?
-
I have some question about design my database. I want to design a database for a Advertisement web site. there are some ads in my site such as:car,shirt,mobile,house,etc... any ads saved by a member of site and belong to it. any ads visited by some member . any ads have it's property .for example car has model,color.mobile has weight,have cam,have tollbooths. house has infrastructure ,stage and .... in FUTURE many ads may add to my site with their specific properties. i want know should i store all of my ads in my table or save them separately?
sepel
-
I have some question about design my database. I want to design a database for a Advertisement web site. there are some ads in my site such as:car,shirt,mobile,house,etc... any ads saved by a member of site and belong to it. any ads visited by some member . any ads have it's property .for example car has model,color.mobile has weight,have cam,have tollbooths. house has infrastructure ,stage and .... in FUTURE many ads may add to my site with their specific properties. i want know should i store all of my ads in my table or save them separately?
sepel
I would recommend you have a Member table and an Advertisement table on with a memberid field which is the member's id who uploaded the advert. A VisitHistory table that contains the Advert id, member id and maybe datetime with foreign keys to the member and Advertisement tables. A table with main categories like cars, mobiles, houses etc and then a table with subcategories with a parent id on it which will be the foreign key to the categories table that filters the subcategories for each category. That way you can have all these main categories with all their subcategories and easily add new ones if you want diffirent kinds of adds. This is obviously high level without any indexes or anything but I hope you get the idea. Hope this helps.
-
I would recommend you have a Member table and an Advertisement table on with a memberid field which is the member's id who uploaded the advert. A VisitHistory table that contains the Advert id, member id and maybe datetime with foreign keys to the member and Advertisement tables. A table with main categories like cars, mobiles, houses etc and then a table with subcategories with a parent id on it which will be the foreign key to the categories table that filters the subcategories for each category. That way you can have all these main categories with all their subcategories and easily add new ones if you want diffirent kinds of adds. This is obviously high level without any indexes or anything but I hope you get the idea. Hope this helps.
Use inheritance in your database, so you can add different subclasses of Advert later. From our docs:
In this example, a ServiceProduct and a StockProduct table are defined. Both primary key columns are also declared as foreign keys referencing the Product.Id column. These relationships guarantee that for every ServiceProduct or StockProduct record there will be a corresponding Product record with the same Id. Effectively these two tables inherit from the product table...
Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
Alpha release: Entanglar: Transparant multiplayer framework for .Net games.