Converting an ER diagram drawn in an EA into an SQL script

Source: Internet
Author: User

in the design of the database, think of the exact installation EA software, see if I can use it. EA painting ER model. The results show that not only can draw, but also the entire database design (Generate SQL script).

below to the computer room toll system users -- students as an example. Students can view the balance, can view the computer record, can view the status of the computer, can view the recharge record, can change the password. The steps are as follows:

(1) Establish ER before the diagram, the first EA You should choose which database to use. :

(2) drawing student user's ER model diagram,:

(3) convert to Data Model diagram, select all the entity and attribute names, right click, click Convert appears

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

(5) Any database tables require primary keys, foreign keys, and constraints, and we'll modify these tables, Select any one of the data tables right-click to appear

(6) Click "Properties" button to appear:

(7) click "Table Detail", select "columns", click OK to appear:

(8) Follow the steps to set the primary key and data type for the table. Also we want to add a foreign key to it, check the contact (for example:

Right-click, Select the foreign key, and you can set it. This is done by modifying the basic.

Modified data Model Diagram:

(9) Select the data Model diagram, right click, select "Code Generation"--"Generate Selected Elements", appears:

(Ten) make changes and select all the objects. In file generation, you can select individual files, or you can choose to generate one file per table. Select "Produce one file per table", generated form

Select "Single file" to generate the following form:

This has been created successfully! (SQL script will show you!) )

Look directly at the tables in the database!

Of course, the database created is just a prototype, and we have to optimize it: eliminate repetition and follow the three paradigms.

It's supposed to be a lazy way of generating directly . SQL scripts, but this is also difficult because we have to ER figure quite understand and the relationship between the various tables of a very thorough analysis, or the drawing of the database to make considerable changes.

In our beginner stage, I think it is better to use a hands-on design database, practice the use of the database, but recently encountered a kind of such a way, first try a bit!

Ps : This method is only experimental, not mature! Please give me a lot of advice!

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.