Convert the erimage drawn in EA into an SQL script

Source: Internet
Author: User
When designing a database, I want to install the EA software to see if I can use EA to draw an ER model. The results show that not only can be painted, but also can be used to design a whole set of databases (generate SQL scripts ). The following uses the data center charging system user-student as an example. Students can view the balance, view the machine records, view the machine status, and view the filling records.

When designing a database, I want to install the EA software to see if I can use EA to draw an ER model. The results show that not only can be painted, but also can be used to design a whole set of databases (generate SQL scripts ). The following uses the data center charging system user-student as an example. Students can view the balance, view the machine records, view the machine status, and view the filling records.

When designing a database, I want to install the EA software to see if I can use EA to draw an ER model. The results show that not only can be painted, but also can be used to design a whole set of databases (generate SQL scripts ).

The following uses the data center charging system user-student as an example. Students can view their balances, machine records, machine status, recharge records, and passwords. The procedure is as follows:

(1) Before creating an ergraph, you should first select which database to use in the EA. :

(2) Draw the ER Model diagram of the student User ,:

(3) convert to a data model graph, select all object and attribute names, right-click, and click convert.

(4) Select the ERD to Data Modeling option and save location, click Start conversion, and convert:

(5) Any database table requires a primary key, foreign key, and constraint. Next we modify these tables and right-click any data table. <喎?http: www.2cto.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + icagicagidxpbwcgc3jjjpq = "http://www.2cto.com/uploadfile/Collfiles/20140603/2014060310081251.png" alt = "\">

(6) Click "properties" and the following page appears:

(7) Click "Table Detail", select "columns", and click "OK:

(8) follow the steps to set the primary key and data type for the table. In addition, we need to add a foreign key to it and select the contact (for example:

Right-click and select the foreign key to set it. This completes the modification.

The modified data model diagram:

(9) Select the data model graph, right-click it, and select "code generation" -- "Generate Selected Elements". The following figure is displayed:

(10) modify and select all objects. For "file generation", you can select "single file" or "generate a file for each table ". Select "generate one file for each table" to generate the file.

Select "single file" as follows:

In this way, the instance has been created successfully! (The SQL script is displayed !)

Let's take a look at the tables in the database!

Of course, this database is just a prototype, and we need to optimize it: eliminate duplication and follow the three paradigm.

This should be said to be a lazy way to directly generate SQL scripts, but this is also difficult, because we must have a thorough understanding of the ergraph and a thorough analysis of the relationship between various tables, otherwise, the drawn database needs to be greatly modified.

In our beginner stage, I think it is better to design a database with hands-on operations. I have practiced database usage, but recently I met a method like this. I tried it first!

Ps: I just tried this method and it is not mature yet! Please kindly advise!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.