Preface
As has been heard, EA can not only draw various diagrams (UML, E-R diagram ...). , you can also turn diagrams into SQL scripts, software documents, and code for various languages. So, curious, I hope to take this opportunity to try this refactoring. A variety of documents are written almost, followed by modeling, building a database. So, I drew the E-R diagram and successfully converted it into a database with EA. Here is a detailed introduction to you:
content How to draw e-R diagram
To sum up the E-R model is to find the entity, find the connection, assign the attribute, and eliminate the redundancy from the local model all the global model. Here need to draw E-R diagram after a few points can be noted:
1. You can draw the entity to find contact, and finally the entire system after the completion of the distribution of attributes, so that the local model to the global model is too messy.
2. Contact to find the order, we must find good, otherwise the conversion is unsuccessful.
3. When assigning attributes, you can pay attention to the order, or to the database to be replaced.
Specific Procedures
1, click Add Chart, select Entity Relationship Diagram Entity Relationship
2. Draw e-R diagram, the whole paste up a little messy, on the part of the paste:
3. Select all, right click, click Convert, select ERD to Data modeling, select Display conversion results, select folder, click Start Conversion
4. The relational schema conversion succeeds, and then the primary key, the type and value of the attribute, and the foreign key are set. Specific actions: Select a relational mode, right click, click on the properties, click on the table detail, click Columns/attributes, to set this.
5. Select all relational models, right-click, click "Code Generation"--"Generate Selected Elements", as shown in the following figure
6. OK, the SQL script conversion is successful, then the data table is OK. Below is a screenshot of the datasheet I generated:
Summary
In fact, seemingly difficult things, to understand the principle of what is simple. Next I will try to turn the class diagram directly into the code, the next blog will be introduced to you.