Thursday, February 12, 2004

DB2: Exam-a-Rama

I passed IBM DB2 UBD 8.1 Family Fundementals this morning. This makes me an IBM Certified Database Associate. From now on I will be able to leap tall buildings in a single bound and hold my breath for ages.

How did I do this?
Well I read this book: DB2 Universal Data Base: V8.1 Certification Test 700 Exam CRAM and mucked about with a trial version of DB2 for a while. Easy.

What did I learn?
The exam is mainly DML commands with bits about the DB2 family of products, security and constraints. If you are up to speed with simple SQL then you should pass this exam fairly easily without much preparation. It was worth it tho, as it has filled in quite a few gaps on my general relational database knowledge and I am now familiar with the main DB2 tools: Command Centre, Control Centre etc.

Hey anything else we should know smartypants?
Well one thing I liked about the book was the example table they used:

EMPNO      NAME                 WORKDEPT
---------- -------------------- --------------------
001 jagger A01
002 watts A01
003 richards B01
004 jones C01
001 wyman -
It's the Rolling Stones! This is much better than the sales values for the US states or lots of cobblers about foo() and bar().

He could of taken this a bit further of course, for instance create a table for the Albums:

CREATE TABLE albums ( name char(30) NOT NULL, year INTEGER NOT NULL,
Constraint NOCRAPALBUMS check (year <= 1978))

Notice the constraint in the table definition? This is handy as if the table looks like this:
NAME                     YEAR       
------------------------ ----------
Beggars Banquet 1968
Let it Bleed 1969
Get Your Ya Yas Out 1970
Sticky Fingers 1971
Exile On Main Street 1972
Goats Head Soup 1973
It's Only Rock and Roll 1974
Black and Blue 1975
Love You Live 1976
Some Girls 1978


And you try and add

INSERT INTO Albums('Emotional Rescue' , 1980) 

you will get the error:
SQL0545N  The requested operation is not allowed because a row 
does not satisfy the check constraint "NOCRAPALBUMS"
".
Explanation:

Check constraint violations can occur on either INSERT or UPDATE
operations. The resulting row violated the check constraint
definition on that table.

The statement cannot be processed.


and rightly so dontcha think ;-).

This page is powered by Blogger. Isn't yours?