The Data Warrior

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

Better Data Modeling: Are you making these 3 beginner mistakes in your data models?

There are lots of people in the database industry that end up building data models.

Some of them are very educated and well trained and are professional data modelers and data architects. (If that is you, you can probably skip this article)

Others have learned on-the-job with little or no training or education on modeling concepts or techniques. They may be database administrators or even programmers that got asked to produce a model diagram by their boss or project manager, after the project was delivered (but there was no data modeler on the project ever).

This article is for this last group of folks who may want to improve their knowledge or skill in data modeling.

So here are three of the most common mistakes I have seen over the years:

1. Only defining surrogate keys

Do all your tables have a primary key defined and that primary key is a single column integer generated by the system? That is a surrogate key.

Instead of that, you should be defining a natural, or business, key for every table in your system. A natural key is a an attribute or set of attributes (that occur naturally in the data set) required to uniquely identify a row in that table. In addition you should define a Unique Key Constraint on those attributes in the database. Then you can be sure you will not get any duplicate data into the tables.

CLARIFICATION: This point has caused a lot of questions and comments. To be clear, the mistake here is to have ONLY defined a surrogate key. i believe that even if using surrogate keys is the best solution for your design, you should ALSO define an alternate unique natural key.

2. Using Visio or PowerPoint to draw your data model diagrams

This is all too common when no data modeler has been hired for a project or there is a really tight (as in NO) budget. The result is a pretty picture that gets out of date very quickly and can’t help you generate DDL code to build (or rebuild) the database.

Instead of that, you should either invest in a real data modeling tool (like ERWin), or better still, get Oracle’s totally free SQL Developer Data Modeler (my favorite!). The point being with a real data modeling  tool, you can forward and reverse engineer your database tables, make changes, review them, generate DDL, etc.

3. Not reviewing the model with real business people

Build it and they will come does not work!  How do you even know you are using the right terminology or have defined the relationships correctly if you have not talked to a business person about their data and data needs?

Instead of that, you need to involve business users from the very beginning of the project. You need to either set up 1:1 interviews with key stake holders or better yet have group JAD sessions to discuss the project and have them help you define the data model. That is the best way to get buy in to the end result.

Just avoiding these three rookie mistakes can greatly improve your chance of success.

Bonus Tip:  The best way to avoid these and other common rookie mistakes is to use a pre-defined data model review checklist.

You can get a jump-start on your own check list by downloading  my Kindle book A Checklist for Doing Data Model Design Reviews on Amazon.com.

Get it here: http://www.amazon.com/Check-Doing-Design-Reviews-ebook/dp/B008RG9L5E/, or just search Amazon for author Kent Graziano.

Here’s to building better data models! Are you with me?

Kent Graziano

The Data Warrior

If you realize that all things change…

If you realize that all things change, there is nothing you will try to hold on to. If you are not afraid of dying, there is nothing you cannot achieve.

~Lao Tzu

Technical Content is King: ODTUG User Group Sunday at #OOW13

Yes boys and girls, it’s that time of year again.

Time for Oracle Open World 2013 at the Moscone Center in San Francisco USA.

Time to gather with 50,000 (or so)  of your closest Oracle pals in the city by the bay.

Time to catch up on all things Oracle.

Big things I expect to hear about this year?

More Oracle 12c, SQL Developer 4.0, and of course…

BIG DATA

and

THE CLOUD!

(There is also a pretty good chance we will here a lot about The America’s Cup finals and Team USA)

And of course my good friends at ODTUG have put together another stellar lineup of Oracle ACEs, ACE Directors and all around Oracle guru’s to kick the week off with the best technical content about Oracle and Oracle tools in the known universe (seriously that is not an exaggeration).

There are sessions on database development, APEX, Hyperion/EPM, ADF, and the Oracle BI applications.

It will be an awesome day of learning.

Check out the full agenda and details here.

Then click on the OOW button on the upper right to register for the conference. Rooms are going fast and you do not want to miss this.

See you in San Fran!

Kent

The Oracle Data Warrior

p.s. As usually the music line up for the annual appreciation event is amazing too!

Another Quick Tip for SQL Developer Data Modeler

Not sure how I missed this little utility, but I did.

Ever need to quickly build a set of views on a set of tables to create a read-only data layer you could expose to some users or processes?

Well as I am developing a new data warehouse for my current client, we decided to control access by creating a read-only user that would hold views that pointed back to our main data warehouse schema. The BI tool points to the read only schema (for now anyway).

Anyway, under the Tools menu I found a Table to View generator.

Under the Tools menu look for the Wizard to create a view definition based on a table

Under the Tools menu look for the Wizard to create a view definition based on a table

Once you select it from the menu you get a dialog box with all the tables in your model selected. So with one push of a button you have views on all the tables.

Get a list of table to convert and Select or Deselect all

Get a list of table to convert and Select or Deselect all

Then you can edit the views, if needed, using the view query builder.

Or you can select (or de-select) specific tables to build views on.

Even better – the tool applies a naming standard on the output view names (v_<table name>).

On top of this, if you happen to have some views (maybe for testing?) that you want to turn into tables and then populate with an ETL process, right below the first wizard is an option to create a table definition from the view definition.

Now granted most of you can easily do either of these tasks using plain old SQL, but imagine you need to do it for several hundred tables.

This little wizard would save you a ton of time (and testing).

And you will have a documented data model when you are done.

So go give it a try!

Later.

Kent

NB: I am taking a little downtime in early August so don’t look for any new posts until near the end of the month.

In great attempts

In great attempts, it is glorious even to fail.

Longinus (Philosopher and proto-Klingon)

Hey – you can at least say you gave it a shot even if oyu go down in flames!

Have a great weekend!
Kent

Post Navigation