The Data Warrior

Changing the world, one data model at a time. How can I help you?

How to define a PK using Data Modeler?

A good “how to” article from Heli for those just getting started with Oracle Data Modeler. Don’t forget you get more good information like this from her new Oracle Press book on Amazon.com: Oracle SQL Developer Data Modeler.

Model on!
Kent
The Data Warrior

HeliFromFinland

Primary Key (PK) identifies uniquely each row in a table. There can never be two tuples with same values in PK.

There are two ways of defining a PK: a natural key or a surrogate key. I would say that if you can find a natural key that is always better. But it is not always possible and therefore we can also use surrogate PKs. Surrogates are usually sequence numbers that has no meaning to the business people, the end users.

Let’s have an example of an entity for all the users in a company.

PK1

PK2

1. Defining a natural PK

What I want is that there will never be more than one user with the same username. If this means that there can NEVER be two with the same username, I would define the PK like this:

PK3

You can see the PK definition from Unique Identifiers tab:

PK4

And by clicking…

View original post 628 more words

Advertisements

Single Post Navigation

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: