Design and generate database

You can design database with ERD, and construct database by generating from the resulting ERD. In this tutorial, you will draw a simple ERD of phone book and generate database to MS SQL from it.

November 22, 2010
User Rating: / 2
Views: 1,913
PDF Link Add comments
Edition: Standard or above (Edition comparison)

  1. Select New > Project... from the main menu of Visual Studio.
    new project
  2. In the New Project dialog box, select Class Library as template, enter PhoneBook as project name and click OK.
    name project
  3. In the Solution Explorer, right click on the project PhoneBook and select Open VP-UML from the popup menu.
  4. Click OK when the project structure dialog box appears.
  5. From the Diagram Navigator, right click on Entity Relationship Diagram node and select New Entity Relationship Diagram from the popup menu. This creates a blank entity relationship diagram.
    new erd
  6. Select Entity from the diagram toolbar.
    select entity
  7. Click on the diagram to create an entity. Name it as Book and press Enter to confirm editing.
    new entity
  8. Right click on the Book entity and select New Column from the popup menu.
    new column
  9. Input +id : int and press Enter.
  10. Input description : varchar(255) and press Enter. Press Esc to confirm editing.
    column added
  11. A phone book contains many contacts. Let's create a Contact entity from the Book entity with a one-to-many-relationship. Move the mouse pointer over the Book entity. Press on One-to-Many Relationship -> Entity and drag it out.
    create entity
  12. Release the mouse button and name it as Contact.
    contact created
  13. Right click on the Contact entity and select New Column from the popup menu.
    new column
  14. Input +id : int and press Enter.
  15. Input name : varchar(100) and press Enter.
  16. Input age : int and press Enter. Press Esc to confirm editing.
    contact created
  17. Select Modeling > ORM > Generate Database... from the main menu.
    generate db
  18. In the Database Code Generation dialog box, click Database Options.
    db options
  19. In this tutorial, we use MS SQL Server as the target database. You may use your own database like My SQL, Oracle or other. Select MS SQL Server and fill in the setting on the right hand side. You may download the driver file by pressing the down button.
    db config
  20. Click OK.
  21. Check Export to database.
    export to db
  22. Click OK to start database generation.
  23. Check the target database. You can see the tables generated.
    mysql

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Writing Effective Use Case
  2. Draw Entity Relationship Diagram (ERD)
    Tagged:
  3. UML Package Diagram
    Tagged:
  4. Produce UML Use Cases from Business Process Diagram (BPD)
  5. Oracle database design with Entity Relationship Diagram
Tags of this article:

Comments (0)

Write comment

Rating

Comment

Enter the calculation result

security code