IToverview.com - Easy To Learn Tutorials!

IToverview.com

Tutorials


Create a Data Model using Visio

Follow these simple steps to create a data model with two entities.

  1. Open Visio software.
  2. On the left hand side, under Choose Drawing Select Type, click the category "Database". Click the template "Database Model Diagram".
  3. Alternate way of opening is to go to "File" menu. Click New and then click "Choose drawing type". Out of the several options displayed, click "Database Model Diagram".
  4. This will take you to a workplace where data model will be created. This workplace has got different panes. On the left hand side, you can see the different icons for creating entity, relationship, view etc. The grid is the place where you are going to drag and drop these icons to create the data model.
  5. Below that, in "Database Properties" tab, you can see the categories for creating Tables, Columns, Primary IDS, Indexes, Triggers, Check, Extended Notes etc. If you don't see the Database Properties tab then, double click on the table. This will open the Database Properties window. Drag that window in such a way that it positions itself at the bottom of the grid.
  6. To create a Table, click the icon 'Entity' and drop it on the workplace. Under Category, place the cursor on the category 'Definition'. Change/Type the conceptual name(logical name) and physical name(table name) as 'COUNTRY'. As per your business requirements, you can enter metadata in name space, owner, source database and defining type.
  7. To create a Column, place the cursor on the category "Columns". Type column name as "COUNTRY_CODE". Select the data type or type your datatype as VARCHAR(10). Select the option Primary Key to identify attribute "COUNTRY_CODE" as the primary key. If you want to edit the column or need to add more properties to the column, place the cursor on the column 'COUNTRY_CODE'. Click edit and you can edit or add more properties like definition, datatype, collection, extended, check, extended, notes.
  8. Follow the same approach to create another column "COUNTRY_NAME". Type datatype as VARCHAR2(50), check "Required" option and do not select the primary key option. Now you will be having two columns COUNTRY_CODE, and COUNTRY_NAME under the table "COUNTRY" on the grid.
  9. Create another table "BANK" with two columns namely BANK_CODE and BANK_NAME by following steps 5 through 7.
  10. In order to relate these two tables(COUNTRY & BANK), a Foreign Key relationship must be created. To create a Foreign Key relationship, follow these steps.
  11. Drag the "Relationship" icon and drop it on BANK_CODE column. Now you can see the relationship i.e a line drawn from Bank. Now drag that arrow until you drop it on the COUNTRY_CODE column of COUNTRY table. When you did that, you can see a new column "COUNTRY_CODE" in BANK table, that has been inherited from COUNTRY table.
  12. Place the cursor on the relationship and you can edit the database properties of that relationship.
  13. You can give a name, change the cardinality, identifying and non-identifying relationship, etc.
  14. Now the data model is ready and if you have a higher version of Visio, then you can forward engineer the data model to create DDL scripts for creating a database.




Previous  Visio & Data Modeling