database modeling using Erwin and Erstudio (by quqi99)
Author: Zhang Hua published in: 2007-10-25 (http://blog.csdn.net/quqi99)
Copyright NOTICE: You can reprint, reprint, please be sure to hyperlink form to indicate the original source and author information and this copyright notice.
There are two views of logical view and physical view in Erwin.
First of all, modeling in logical view, in the left tree entities midpoint "new" can build a table, after the completion of a table, you can build a property in this table (on the attributes right click). The external constraint is defined in key groups, the primary key definition well, it is worth mentioning the foreign key, for example, there are two tables (User table: Id,deptid,name Dept Table: deptid,name), the user table and the Dept table is a many-to-many relationship, DeptID in the user table as a foreign key, the primary key of the Dept table must be the same as the DeptID, because the foreign key cannot be selected when the foreign key constraint relationship is built. It's OK to pay attention to this.
Then, in physical view, you can synchronize these defined tables directly into the physical database. Only in this view, point "tools"----"Schema generator" can be.
----------------------------------------------------------------------------------
In Erstudio, when you first build entities, when you build a foreign key constraint, for example, there are two tables (User table: Id,deptid,name Dept Table: Deptid,name), and the user table is a many-to-many relationship to the Dept table. The DeptID in the user table acts as a foreign key. Table User (Id,name) should be built first. (Note that the DeptID attribute is not built first), and then enter deptid This field in the process of building the relationship.
When you finish generating the logical view, right-click on it to generate the physical model. Follow the prompts
After the physical view is generated, right-click on it to generate the database, including directly building tables and exporting SQL statements in the database.