Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sork's avatar
Level 1

design database tables for real estate contracts

I am creating an app to manage real estate sale and rent contracts. i do have three tables as below:

contracts : contain columns that are available in both rent and sale contracts such as: client name, landlord name, location ...etc.

rent_contracts: contain columns that are specific only for rent contracts such as: rent start date , end date ..etc.

sale_contracts: contain columns that are specific only for sale contracts.

i would like to ask

  • having three tables like above is a good approach?
  • is there any other table design idea for such a system?
0 likes
2 replies
jbowman99's avatar

@sork

just an idea, you could have 1 contracts table and add a column of type, have all of the fields on the one table, including rent start and end etc... you could make certain column's null-able so they could remain empty or NULL

then query the table on the type column, this way you can still call all() on contracts and limit your queries at times, since you'd only have the one model Contract...

1 like
stanb's avatar

I do not really agree with jbowman99. But this does not mean it is a bad suggestion or incorrect. It is what I would not do myself. This is because that I believe more in your approach to have each type separated. (I would make only two tables and have in both rent and sale tables the same columns) Because you will have different models which can have different rules, methods, validation, etc. I think it will make your code much more readable and maintainable if you separated it.

I hope this make sense.

Please or to participate in this conversation.