/    Sign up×
Community /Pin to ProfileBookmark

How to structure a basic Real Estate website Database

Hello,

I’m working on a basic functional real estate Database website. I am actually working on how to build an efficient and scalable database for the website. how can I separate the data, for example should I separate the address from the property table etc. What are some best practice I can apply to build a good and scalable database. I’m a bit new to database modeling so feel free propose a database design. This is what I’ve been doing so far, its really primitive:

Thanks

https://drive.google.com/file/d/1-5OXM1x0sDffDDEqRmYq_pG60wfzrHN1/view?usp=sharing

to post a comment

5 Comments(s)

Copy linkTweet thisAlerts:
@sibertSep 15.2021 — > @Salvignol#1637057 for example should I separate the address from the property table etc

You can have several tables. The benefits of this is that you can add assets dynamically.

users -> property -> asset links (many to many) -> assets (1 pool, 2 cooling 3 +endless assets)

You can also have type and mode in a separate lookup table. As type and mode normally will be one to many there is no need for a link table.

This makes it more expandable in the future.
Copy linkTweet thisAlerts:
@SalvignolauthorSep 15.2021 — @sibert#1637058 By asset links do you mean that the assets table as a foreign key to assets link, I'm a bit confused when it comes to using many to many relations 😅
Copy linkTweet thisAlerts:
@sibertSep 15.2021 — > @Salvignol#1637059 By asset links do you mean that the assets table as a foreign key to assets link

As the property can have many "assets" (like pool, bathroom etc cannot find a better word...). And each asset can belong to many properties, you have to have a "table" between. Have a look at this answer (scroll down) to a description of a "link table" to manage many-to-many relations.

https://stackoverflow.com/questions/7296846/how-to-implement-one-to-one-one-to-many-and-many-to-many-relationships-while-de
Copy linkTweet thisAlerts:
@SalvignolauthorSep 15.2021 — @sibert#1637067 thanks a lot, that has been pretty clear, that is so much better
Copy linkTweet thisAlerts:
@NogDogSep 15.2021 — Just to add on, I tend to try to keep an eye open for many-to-one and many-to-many relationships, as those are definite indicators that you either need two tables (many-to-one) or three (many-to-many) to represent those relationships.

These multiples can be obvious (a user may own multiple properties -- could a property be owned by multiple users?), but some can be a bit less clear, but show up if you realize you are entering the same value for something (e.g. "broadband" or "satellite" for an internet column, e.g.), and things could get messy if you don't always type them the same way -- in which case those options may belong in a separate table that your property then references by the ID of the internet table.
×

Success!

Help @Salvignol spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...