For example if I have 20 tables, I have to design it by section? i.e
CLIENT (id, name...) -- orders -- ODERS_DE开发者_如何学CTAIL(id, products...)
.
.
.
lives --- ADDRESS(...)
Or I can use The MySQL Workbench EER Model (To me, it looks like the Pysical Model)?
Or like this: Data Modeling Levels
Well, I would not do it in code. That is for the RDBMS itself. MySQL EER Workbench does not do true entity modeling - it is modeling tables, you are correct. If you want true ER modeling I suggest Oracle's newly released ('Early Adopter') SQL Developer Data Modeler. It is pretty easy to use, is free and can forward and reverse engineer models to tables. http://www.oracle.com/technetwork/developer-tools/datamodeler/overview/index.html
When in doubt, design a table that is totally flat, and then determine where you have duplicated data, these can be considered for tables (entities).
The "ER model" defines entities unto themselves and allow the reference of entity-to-entity (table-to-table) through a separate relation. If you can remove yourself from thinking about foreign keys in your entities and focus on the relations in their own separate table.
精彩评论