Click here to Skip to main content
15,913,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys, ive been wondering, i have this situation...

im making a simple well i thougth it would be simple database structure for a "post your own ads" application,

now i have the basic layout of the main table called post

[post]
id_post
title
body
id_user
id_category


now, depending on the category there should be another table with the properties ( columns ) of that category i.e

[category]
id_category | description
1 | houses

[post_cat_houses]
id_post_cat_house
bathrooms
rooms
square_feet


is there a better way to do this?? i mean do i really need to have an extra table per category??

because i cannot add all the properties in the same table as post since diff categories WILL have diff properties.


hope i made sense.. thanks for you help in advance
Posted

1 solution

It's hard to see what you are trying to do...maybe you need to research[^] a bit more.

But from the looks of it...if your next category is going to be Apartments....then you probably don't need another table with Apartment properties because they should be very similar to House properties. Add a field to your Properties table that says if it's a House or Apartment.

If that is not what you meant...then please provide more information.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900