I ask this to learn from experienced DB designers/architects. I need a high-level overview, I'm not interested in the specific tools for now. Rather, I'd like opinions on how you would approach this task and the recommended ways to do this.
I was asked to create a database for a small company that wants to 'manage' its client's buildings. I acknowledge that 'manage' is a rather broad term, but this is not uncommon for clients, you know. So bear with me for now. Also, I am a novice in this particular task so I am learning.
At first, I imagined two related tables, one for the owners and another for the buildings. The Owners table would have columns such as Owner ID, name, surname, amount of buildings, tax codes, history of membership, etc. The Buildings table would have the information of each building, such as Building ID, owner ID, address, surface area, estimated value, tax status, maintenance status, maintenance history, etc. The amount of columns/fields, and exactly which columns are needed is not really the point for now. The important thing is that
- both tables are related (a given owner can have multiple buildings, and each building can have multiple owners), and
- the information include both 'native' types (strings, dates, numbers) as well as history-like. By this latter I mean, for example if we need to store the history of recorded values of a building along the years, that field requires a list of values (say, year, value and a 3rd field with 'notes'). This history is a feature that belongs to the building, but I am not sure how to include it. Should I consider the value history as a separate table for each building? Also each building needs several 'historical' data that we will need to plot, eg. the taxes paid each year for the last 10 years (don't ask me about the usefulness of this, I have no idea). Should I consider each 'history' (taxes, value, maintenance cost, etc.) as a separate table related to each building? This could be nice because it seems more 'modular' to me, so more tables can be added later with more historical values, while adding just one additional field to the 'buildings' table. Make sense?
Similarly, each owner will also have historical values (eg membership, number of buildings owned, etc.). So how to deal with this?
After thinking about all this, it also comes to my mind that maybe it is useful to think of these as classes (in the OOP sense), so each building is an object with many fields (attributes) and I can even assign methods. Then it becomes much clearer to me.
Am I mixing things here? What is the initial approach you suggest, can you point me to some sources to read about this? I don't even know the appropriate name, I assume it is related to 'database design' or 'data engineer/architect'.
Any comment will be of much help :)