Introduction to ERwin

Similar documents
Database. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Database Systems. S. Adams. Dilbert. Available: Hans-Petter Halvorsen

SQL Server and SQL Structured Query Language

Database Views & Stored Procedures. Hans-Petter Halvorsen, M.Sc.

Database Lab. Hans-Petter Halvorsen

Database Overview. Introduction to Database Systems, ERwin, SQL Server, SQL, etc. Hans-Petter Halvorsen, M.Sc.

Create a Virtual Test Environment

UML. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Industrial IT Laboratory Work Hans-Petter Halvorsen

Using SQL Server in C#

Structured Query Language

Visual Studio Team Services

Unit Testing. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

MATLAB Examples. Simulink. Hans-Petter Halvorsen, M.Sc.

Team Foundation Server Visual Studio Team Services. Hans-Petter Halvorsen, M.Sc.

MATLAB Examples. Flow Control and Loops. Hans-Petter Halvorsen, M.Sc.

University College of Southeast Norway. Web Services. with Examples. Hans-Petter Halvorsen,

University College of Southeast Norway. Introduction to Database. Systems. Hans-Petter Halvorsen,

Create Installation Packages in Visual Studio

Simulation in LabVIEW. Hans-Petter Halvorsen, M.Sc.

Week Assignment Source Code Control (SCC) & Bug Tracking Systems Hans-Petter Halvorsen

Team Assignment. Final Software Delivery. IA4412 Software Engineering

Modbus Hans-Petter Halvorsen

Week Assignment. Source Code Control (SCC) & Bug Tracking Systems. Hans-Petter Halvorsen

Software Implementation

University College of Southeast Norway. LM-900 Level Tank. Hans-Petter Halvorsen,

Create a simple database with MySQL

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

The Relational Model. Suan Lee

Wireless DAQ using ZigBee

Software Documentation

MySQL. A practical introduction to database design

MATLAB Examples. Interpolation and Curve Fitting. Hans-Petter Halvorsen

UML. Unified Modeling Language. Hans-Petter Halvorsen, M.Sc. O. Widder. (2013). geek&poke. Available:

Datalogging and Monitoring

Introduction to Simulink

SCADA Lab. Supervisory Control and Data Acquisition. Hans-Petter Halvorsen

Project Database Rules

Solutions. Discretization HANS-PETTER HALVORSEN,

Introduction to MATLAB

ERD Tutorial: How to Design and Generate SQL Server DB? Written Date : June 19, 2015

The appendix contains information about the Classic Models database. Place your answers on the examination paper and any additional paper used.

Programming. Languages & Frameworks. Hans-Petter Halvorsen, M.Sc. O. Widder. (2013). geek&poke. Available:

CLASS DISCUSSION AND NOTES

Software Architecture

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

Software Testing. Hans-Petter Halvorsen, M.Sc.

Toad Data Modeler Limitation Matrix

Database Modeling. DBTech-EXT - Thessaloniki, Greece Outi Virkki - Haaga-Helia University of Applied Sciences.

Software Platforms. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

NI mydaq HANS-PETTER HALVORSEN, Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

Virtual Instruments with LabVIEW

NI Vision System HANS- PETTER HALVORSEN,

Source Code Control. Quiz with Explainations. Hans-Petter Halvorsen, M.Sc.

Industry Models. Physical Model Guidelines. Industry Models - Physical Model Guidelines. Industry Models - Physical Model Guidelines November 21, 2013

A practical introduction to database design

Datalogging in LabVIEW

A hypothetical M:M student schedule example

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

Web Services Hans-Petter Halvorsen

Source Code Control & Bug Tracking

Control and Simulation in. LabVIEW

Software Architecture

The Entity Relationship Model

Raspberry Pi. Hans-Petter Halvorsen, M.Sc.

Relational model and basic SQL

Recommended Maintenance Plan for Siriusware Clients for SQL server 2005

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

University College of Southeast Norway ASP.NET. Web Programming. Hans-Petter Halvorsen,

MySQL Data Modeling Tutorial

CSC 453 Database Technologies. Tanu Malik DePaul University

Introduction to Databases

Chapter 4. The Relational Model

Data Acquisition HANS-PETTER HALVORSEN,

CA ERwin Data Modeler

SQL Server 2008 Tutorial 3: Database Creation

CA ERwin Data Modeler

University College of Southeast Norway. Database Communication. in LabVIEW. Hans-Petter Halvorsen,

Database Communication in Visual Studio/C# using Web Services

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

A database consists of several tables (relations) AccountNum

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

State Estimation with Observers

Learning Alliance Corporation, Inc. For more info: go to

CA ERwin Data Modeler

Physical Design of Relational Databases

CA ERwin Data Modeler

LabVIEW MathScript Quick Reference

DataBase Lab Lab # 7 ER Using ERWin

Sql Server 2008 R2 Print Database Diagrams Export

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

How To Convert An Er Diagram Into Relational Schema Example

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

CSE 344 AUGUST 1 ST ENTITIES

Creating Classes and Libraries with Arduino

Introduction to MySQL /MariaDB and SQL Basics. Read Chapter 3!

Database Design. 9-2 Basic Mapping: The Transformation Process. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Ch 9: Mapping EER to Relational. Follow a seven-step algorithm to convert the basic ER model constructs into relations steps 1-7

Transcription:

Introduction to ERwin Database Design & Modelling Hans-Petter Halvorsen, M.Sc.

Software The following Editions can be downloaded for Free on Internet: CA ERwin Data Modeler Community Edition SQL Server Express Edition

Overview 1. Design and Create Tables 2. Make a SQL Script 3. Execute the Script within SQL Server 4. Start using your Database, Insert Data, etc.

Database Design & Modelling Hans-Petter Halvorsen, M.Sc.

Database Design ER Diagram ER Diagram (Entity-Relationship Diagram) Used for Design and Modeling of Databases. Specify Tables and relationship between them (Primary Keys and Foreign Keys) Example: Table Name Table Name Column Names Primary Key Primary Key Foreign Key Relational Database. In a relational database all the tables have one or more relation with each other using Primary Keys (PK) and Foreign Keys (FK). Note! You can only have one PK in a table, but you may have several FK s.

Database - Best Practice Tables: Use upper case and singular form in table names not plural, e.g., STUDENT (not students ) Columns: Use Pascal notation, e.g., StudentId Primary Key: If the table name is COURSE, name the Primary Key column CourseId, etc. Always use Integer and Identity(1,1) for Primary Keys. Use UNIQUE constraint for other columns that needs to be unique, e.g. RoomNumber Specify Required Columns (NOT NULL) i.e., which columns that need to have data or not Standardize on few/these Data Types: int, float, varchar(x), datetime, bit Use English for table and column names Avoid abbreviations! (Use RoomNumber not RoomNo, RoomNr,...)

Database Design & Implementation Recommended Steps: 1. Database Modelling/Design using ERwin 2. Generate SQL Table Script using ERwin (you might need to adjust/improve it in order to make it more robust) 3. Generate Tables in SQL Server using the SQL Script generated by ERwin 4. Create Stored Procedures, View, Triggers, etc. inside SQL Server if needed.

ERwin Hans-Petter Halvorsen, M.Sc.

CA ERwin Data Modeler Community Edition Tool for Database Modelling (ER Diagrams) Free! Forward and Reverse Engineering with a 25 object limit Download here: http://erwin.com/products/data-modeler/community-edition

ERwin Example

Open ERwin and select File->New... The following window appears (New Model): New Database Model Make sure to select Logical/Physical Model Select the Database Type and Version you shall use

Page Setup

Exercise Lets try to create the following Tables, Columns, Primary Keys and Foreign Keys using ERwin:

Create Tables and Columns Use the Entity Tool in order to Create New Tables Use <Tab> and <Enter> in order to give the Tables a Name and to create Columns. Use the <Arrows> to switch between the Columns inside a Table

Create Primary Key (PK) Foreign Key (FK) Relationships Use the Relationship Tool in order to Create a Primary Key (PK) Foreign Key (FK) Relationship Click first on the PK table and then on the FK table using the Relationship Tool. The Relationship Connection is then Created Automatically

Set Data Types Make sure to set proper Data Types You may also Double-click (or Right-click and select Table/Column Properties) on Tables and Columns in order to change different Attributes, eg. Data Types, etc.

Attributes

More Tables... We can extend our Database Design/Modell with, e.g.: AUTHOR PUBLISHER CATEGORY (e.g., Programming, Control Systems,..)... (You can try this on your own)

Create SQL Scripts with ERwin Hans-Petter Halvorsen, M.Sc.

Create SQL Script 1 Make sure you are using the Physical Model 2 Select Forward Engineering and Schema... 3 4 Select/Deselect different Options in order to make your script the way you want. Click Preview in order to see the results. Click Save when you are satisfied with your Script

SQL Server Execute the SQL Script within SQL Server Hans-Petter Halvorsen, M.Sc.

Microsoft SQL Server Software

Microsoft SQL Server Management Studio 3 Your SQL Server 1 2 Your Database 4 Write your Query here Your Tables 5 The Results from your Query

Microsoft SQL Server Create a New Database 2 1 Name you database according to your Project

1 Open SQL Server and create a New Database... SQL Server 3 You are Finished. Start inserting some test data, etc. 2 Open the SQL Script in order to insert the Tables in SQL Server

Identity (1,1) Hans-Petter Halvorsen, M.Sc.

1 Setting the Identity(1,1) Property in ERwin 2 3

Exercise Hans-Petter Halvorsen, M.Sc.

Create this Example using ERwin. Create a Script and execute it within SQL Server. Database Design & Modelling Exercise

Hans-Petter Halvorsen, M.Sc. University College of Southeast Norway www.usn.no E-mail: hans.p.halvorsen@hit.no Blog: http://home.hit.no/~hansha/