A class diagram is a system using an object model. A relational database diagram is a data system using a relational model. There are significant differences between the way these two models will represent the same system. And the data model does not model behavior. It models only data.
However, there is a modeling system that is halfway between the class diagram and the relational diagram. It is called an ER chart, where ER is short for Entity-Relationship. In the ER model, an entire subject is analyzed for “entities,” which can be people, places, or things that have a personality. They can even be intangible things like a bank account. Relationships relate to two or more entities and its statements about the relationships that make up most of the data in the database. Data values are instances of attributes, and attributes describe either entities or relationships between objects.
Most of the ER charts that you see in SO are really relational charts, masquerading as ER charts. In this ER diagram, foreign keys are missing, many-to-many relationships can be displayed as a single line, and things like gene-spec patterns look the same as in class diagrams. If fact, the ER diagram can be considered as a projection of the object world only onto the data world.
If you study ER modeling as a separate activity from relational modeling, as a result of getting a different model, it will be easy for you to convert class diagrams to ER diagrams.
Hence the transformation of ER diagrams into relational diagrams is almost mechanical. Each object gets a table, many-to-many relationships get their own table. Inheritance and association receive special treatment and so on. Relations, which were considered abstractions in the world of ER modeling, materialized as foreign keys. The primary key of each table becomes apparent in terms of the key attributes of the objects in the ER model.
And the so-called attributes in the ER model (possibly “properties” in the class model) become “columns” in the relational model.
there are some fancy tools that manage object models, ER models, and relational models in the same tool and can move between these models for you. One of them, the Data Architect, was very good, but very expensive a few years ago.
Walter mitty
source share