To display keys in your ER diagram
From the Display Level dropdown menu on the Display Toolbar, select Primary Keys or PK and FK Keys or All Keys.
To define display level for a specificWorkspace
Right-click the work area | Workspace Format | Entity tab | Display Level.
To display keys graphically in your ER diagram
Right-click the work area | Workspace Format | Entity tab | check the Display Keys Graphically checkbox.
To change the default key attributes color
Select Settings | Options | Model section | Physical Model | Entity tab | Attribute Colors area.
To highlight key attributes on your Workspace
Point your cursor at a relationship line.
|
TIP: When you point your mouse cursor at a relationship line, parent and child attributes are highlighted on the Workspace. You can set the color at: Settings | Options | Graphics | Colors area | Highlight Color. |
An entity can have a primary key and many alternate keys. The keys are stored in the Keys tab in the Entity Properties form.
To create a key
- Right-click an entity on the Workspace and select Add | Key. The Key Properties dialog opens.
To create a PK (unique) attribute
- Right-click an entity on the Workspace and select Add | Attribute. The Attribute Properties dialog opens.
- On tab General, select the Primary Key (Unique) checkbox.
To assign an attribute to key
- In the Entity Properties dialog, Attributes tab, double-click the empty space in the Key column next to the selected attribute.
or
- In the Key Properties dialog | Attributes tab.
|
Note:
- Primary keys are graphically marked by red key by default.
- A primary key can be added to more attributes.
- It is possible to delete primary keys. It is not possible to delete alternate keys of unique attributes.
|
NotNull Property for PK and AK Attributes
Toad Data Modeler allows you to check/uncheck the NotNull property for PK and AK attributes.This is possible only if the Allow Null Attributes in Keys checkbox is selected (unchecked by default).
To select this checkbox
Select Settings | Options | Physical Model and select the checkbox.
If this checkbox is not selected, Toad Data Modeler doesn’t allow you to uncheck the NotNull checkbox in key attributes.
The availability of this option differs by database:
DB2 z/OS v. 9, 10, 11 |
n/a |
n/a |
DB2 v. 8, 9.x, 10.x |
n/a |
n/a |
Greenplum |
n/a |
available |
Ingres 9.3, 10 |
n/a |
n/a |
Microsoft Access |
available |
available |
Microsoft Azure SQL Database |
n/a |
available |
SQL Server 2000 |
n/a |
n/a |
SQL Server 2005 |
n/a |
available |
SQL Server 2008 |
n/a |
available |
SQL Server 2012 |
n/a |
available |
SQL Server 2014 |
n/a |
available |
MySQL 5.x |
n/a |
available |
Oracle |
available |
available |
PostgreSQL |
n/a |
available |
SQLite 3.7 |
available |
available |
Sybase ASE, Sybase IQ |
n/a |
n/a |
Sybase SQL Anywhere |
n/a |
n/a |
Teradata |
n/a |
n/a |
If the Allow Null Attributes in Keys checkbox is selected:
- When you assign an attribute to a key (PK, AK), the Not Null checkbox of the attribute will be checked. (But you are able to uncheck it)
- During propagation of the key via the identifying relationship, the Not Null property in child attribute is inherited from the parent attribute. The only exception is when a database doesn't support Null value in primary key, which would be created via the propagation.
- During Model Conversion, different settings of the Not Null property and its support in different databases are taken into consideration.
- For databases that support Null value in child attribute, the Mandatory Parent checkbox is selected in the Relationship Properties dialog and should behave coherently to Null value in child attribute as well as it behaves for non-identifying relationships.
- For databases that support Null value in child attribute, the settings of the Synchronize NotNull with Mandatory Parent option work the same way for PFK as for FK.
See Synchronization of NotNull and Mandatory Parent for more information.