Download presentation
1
Using ER/Studio
2
Modeling a Relational Database Using ER Studio
We will use ER Studio as the modeling Tool to build ER diagrams. ER Studio Is a CASE tool providing a Repository (or System Catalog) of an organization’s databases Fully specified logical models in ER studio can be used to generate DDL the code of the create tables statements
3
Getting to ER Studio Data Architect
Enter ERS in the Search are of the start menu Click on the ER Studio Data Architect 9.6 icon Click on tools in the top menu and then select options from the drop-down menu
4
Set Options to Produce Crow’s-Foot Notation
Pick logical Pick options from tools drop-down Choose Crow’s feet notation
5
Create a New Model Select File from the top menu and new from the drop down On the dialog box, ensure that Draw a new data model is checked and that relational is selected, then click OK
6
Select an Entity to Add
7
Entity Editor Name the entity then make sure that the Attributes
tab is selected and click the Add button to add attributes
8
Can specify derived attributes and check this box
Adding Attributes Can specify derived attributes and check this box For each attribute specify its name, select a datatype from the listbox, select the column width and check whether nulls are to be allowed for the attribute. Check this box if the attribute is the primary key (or a part of the PK)
9
Other Attribute Properties
Add Default value using the Default tab Simply add the default value: e.g. a system variable as shown or a ‘Y’ for a flag variable, etc. Add check constraints using the rule/constraint tab Note that a constraint name can be specified Check Constraint Value is the full condition to be applied by the Check constraint begins the constraint condition with the attribute name & we just finish out the condition
10
Adding Relationships by Type
identifying Non- identifying Optional Non-identifying Mandatory
11
Relationship Types Identifying Non-identifying Mandatory
Strong relationship child entity is a weak entity Primary key of 1st entity becomes a foreign key and part of the primary key of 2nd entity clicked. Non-identifying Mandatory Weak relationship child entity is a strong entity Primary key of 1st entity specified becomes a foreign key in 2nd entity and foreign key attribute is not null Non-Identifying Optional Weak relationship child entity is strong Primary key of 1st entity specified becomes a foreign key in 2nd entity, but the foreign key attribute can be null.
12
Editing Relationship Properties
Auto add of FK
13
Identifying Relationship Specification
For identifying relationships, Primary key of parent is automatically added to primary key of the child table To complete this specification Phone_No should be added to the primary key of PATRON_PHONE
14
Creating a Sub-Class Hierarchy
First create the Super-Class and sub-Class entities Add at least the primary key to the super-class entity From the insert Drop-down, select sub-type cluster, then pick either complete or incomplete Click on the super-class entity Control-click on the first subclass entity & continue until all sub-class have been linked in (see next slide for menu option, following slide for result.)
15
Choose complete (all super-type members must belong to a sub-type, or incomplete
16
Right click & pick edit subtype cluster to get this Dialog box
17
Saving the Model Change to desired J drive space
18
Generating the Physical Model
19
Physical Model for Oracle
20
Generated SQL for Data Definition Language
-- -- TABLE: ormCustomer CREATE TABLE ormCustomer( custnumber NUMBER(10, 0) NOT NULL, name VARCHAR2(20), CONSTRAINT PK1 PRIMARY KEY (custnumber) ) ; -- TABLE: ormOrder CREATE TABLE ormOrder( ordernumber NUMBER(10, 0) NOT NULL, orderdate DATE NOT NULL, total NUMBER(10, 0), custnumber NUMBER(10, 0) NOT NULL, CONSTRAINT PK2 PRIMARY KEY (ordernumber) ALTER TABLE ormOrder ADD CONSTRAINT ReformCustomer31 FOREIGN KEY (custnumber) REFERENCES ormCustomer(custnumber)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.