48
EVALUATION COPY Database Design Specialist Instructor Guide Web Development Series CCN03-CEDBDM-PR-1103 • version 1.0 • rd050511

Database Design Specialist - EVALUATION COPY

Embed Size (px)

Citation preview

EVAL

UAT

ION

CO

PY

Database Design Specialist Instructor Guide Web Development Series CCN03-CEDBDM-PR-1103 • version 1.0 • rd050511

EVAL

UAT

ION

CO

PY

EVAL

UAT

ION

CO

PY

Database Design Specialist

Instructor Guide

EVAL

UAT

ION

CO

PY

President/Chief Certification Architect James Stanger, Ph.D.

Vice President, Operations Todd Hopkins

Senior Content Developer Kenneth A. Kozakis

Managing Editor Susan M. Lane

Editor Sarah Skodak

Project Manager/Publisher Tina Strong

Customer Service Certification Partners, LLC 1230 W. Washington St., Ste. 111 Tempe, AZ 85281 (602) 275-7700

Copyright © 2011, All rights reserved.

EVAL

UAT

ION

CO

PY

Database Design Specialist Developers

Irina Heer, Jake Mullins and Brian Danks

Editor David Oberman

Project Manager/Publisher Tina Strong

Trademarks Certification Partners is a trademark of Certification Partners, LLC. All product names and services identified throughout this book are trademarks or registered trademarks of their respective companies. They are used throughout this book in editorial fashion only. No such use, or the use of any trade name, is intended to convey endorsement or other affiliation with the book. Copyrights of any screen captures in this book are the property of the software's manufacturer.

Disclaimer Certification Partners, LLC, makes a genuine attempt to ensure the accuracy and quality of the content described herein; however, Certification Partners makes no warranty, express or implied, with respect to the quality, reliability, accuracy, or freedom from error of this document or the products it describes. Certification Partners makes no representation or warranty with respect to the contents hereof and specifically disclaims any implied warranties of fitness for any particular purpose. Certification Partners disclaims all liability for any direct, indirect, incidental or consequential, special or exemplary damages resulting from the use of the information in this document or from the use of any products described in this document. Mention of any product or organization does not constitute an endorsement by Certification Partners of that product or corporation. Data used in examples and labs is intended to be fictional even if actual data is used or accessed. Any resemblance to, or use of real persons or organizations should be treated as entirely coincidental. Certification Partners makes every effort to ensure the accuracy of URLs referenced in all its material, but cannot guarantee that all URLs will be available throughout the life of a course. When this course was published, all URLs were checked for accuracy and completeness. However, due to the ever-changing nature of the Internet, some URLs may no longer be available or may have been redirected.

Copyright Information This training manual is copyrighted and all rights are reserved by Certification Partners, LLC. No part of this publication may be reproduced, transmitted, stored in a retrieval system, modified, or translated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise without written permission of Certification Partners, 1230 W. Washington Street, Suite 111, Tempe, AZ 85281.

Copyright © 2011 by Certification Partners, LLC

All Rights Reserved

ISBN: 0-7423-2816-3

EVAL

UAT

ION

CO

PY

iv

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

EVAL

UAT

ION

CO

PY

v

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Table of Contents Course Description........................................................................................................................ xi Courseware ................................................................................................................................... xi Course Objectives........................................................................................................................ xiv Classroom Setup ......................................................................................................................... xiv System Requirements .................................................................................................................. xv Conventions and Graphics Used in This Book............................................................................. xvii Classroom Setup Guide ............................................................................. Classroom Setup Guide-1 Lesson 1: Introduction to Databases............................................................................................ 1-1

Pre-Assessment Questions ................................................................................................................1-2 Introduction to Databases .................................................................................................................1-3 What Is a Database? .........................................................................................................................1-3 File-Based Databases ........................................................................................................................1-3 The Evolution of Databases ...............................................................................................................1-5 Relational Databases and Database Management Systems (DBMSs) ..................................................1-6 Origins of Relational Databases.........................................................................................................1-9 Case Study......................................................................................................................................1-10 Lesson 1 Review ..............................................................................................................................1-12 Lesson 1 Instructor Section.............................................................................................................1-13

Lesson 2: Relational Database Fundamentals .............................................................................. 2-1 Pre-Assessment Questions ................................................................................................................2-2 Introduction to Relational Databases.................................................................................................2-3 Multitier Database Architecture.........................................................................................................2-3 Relational Model Terminology............................................................................................................2-4 Using Tables to Represent Data.........................................................................................................2-6 Characteristics of Relations ...............................................................................................................2-7 Data Models ....................................................................................................................................2-10 Entities and Data Relationships ......................................................................................................2-10 Relational Integrity..........................................................................................................................2-12 Database Languages .......................................................................................................................2-13 Data Dictionaries ............................................................................................................................2-14 Case Study......................................................................................................................................2-15 Lesson 2 Review ..............................................................................................................................2-18 Lesson 2 Instructor Section.............................................................................................................2-19

Lesson 3: Database Planning ....................................................................................................... 3-1 Pre-Assessment Questions ................................................................................................................3-2 Introduction to Database Planning ....................................................................................................3-3 Database Design Life Cycle................................................................................................................3-3 Database Requirements Document....................................................................................................3-7 ProAudio Case Study.........................................................................................................................3-8 Selecting a DBMS............................................................................................................................3-10 Selecting an Application Interface....................................................................................................3-11 Case Study......................................................................................................................................3-12 Lesson 3 Review ..............................................................................................................................3-14 Lesson 3 Instructor Section.............................................................................................................3-15

Lesson 4: Overview of Database Design Methodology................................................................... 4-1 Pre-Assessment Questions ................................................................................................................4-2 Introduction to Database Design Methodology ...................................................................................4-3 Effects of Poor Database Design Practices..........................................................................................4-3 Database Design Phases....................................................................................................................4-5 Conceptual Database Design.............................................................................................................4-6 Entity-Relationship (ER) Models ........................................................................................................4-8 Case Study......................................................................................................................................4-13 Lesson 4 Review ..............................................................................................................................4-15 Lesson 4 Instructor Section.............................................................................................................4-16

EVAL

UAT

ION

CO

PY

vi

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson 5: Normalization.............................................................................................................. 5-1 Pre-Assessment Questions ................................................................................................................5-2 Introduction to Normalization............................................................................................................5-3 What Is Normalization? .....................................................................................................................5-3 Normal Forms ...................................................................................................................................5-4 First Normal Form.............................................................................................................................5-4 Second Normal Form.........................................................................................................................5-6 Third Normal Form............................................................................................................................5-9 Boyce-Codd Normal Form (BCNF)....................................................................................................5-12 Case Study......................................................................................................................................5-15 Lesson 5 Review ..............................................................................................................................5-19 Lesson 5 Instructor Section.............................................................................................................5-20

Lesson 6: Logical Database Design............................................................................................... 6-1 Pre-Assessment Questions ................................................................................................................6-2 Introduction to Logical Database Design............................................................................................6-3 Logical Database Design....................................................................................................................6-3 Creating a Logical Data Model ...........................................................................................................6-9 Using a Database Definition Language ............................................................................................6-10 Validating the Logical Data Model....................................................................................................6-11 Defining Integrity Constraints .........................................................................................................6-12 Creating an Enterprise Data Model..................................................................................................6-15 Case Study......................................................................................................................................6-16 Lesson 6 Review ..............................................................................................................................6-19 Lesson 6 Instructor Section.............................................................................................................6-21

Lesson 7: Physical Database Design............................................................................................. 7-1 Pre-Assessment Questions ................................................................................................................7-2 Introduction to Physical Database Design..........................................................................................7-3 Physical Database Design..................................................................................................................7-3 MySQL Query Browser ......................................................................................................................7-5 Creating Enterprise Constraints ......................................................................................................7-14 Using Secondary Indexes.................................................................................................................7-17 Denormalization..............................................................................................................................7-18 Creating User Views ........................................................................................................................7-20 Designing Database Access Rules....................................................................................................7-23 Case Study......................................................................................................................................7-29 Lesson 7 Review ..............................................................................................................................7-32 Lesson 7 Instructor Section.............................................................................................................7-34

Lesson 8: Structured Query Language.......................................................................................... 8-1 Pre-Assessment Questions ................................................................................................................8-2 Introduction to Structured Query Language ......................................................................................8-3 SQL Basics........................................................................................................................................8-3 Data Definition Language ..................................................................................................................8-5 Data Manipulation Language.............................................................................................................8-7 Retrieving Data from Relations ........................................................................................................8-11 Data Control Language....................................................................................................................8-19 Case Study......................................................................................................................................8-21 Lesson 8 Review ..............................................................................................................................8-25 Lesson 8 Instructor Section.............................................................................................................8-27

Lesson 9: Relational Algebra........................................................................................................ 9-1 Pre-Assessment Questions ................................................................................................................9-2 Introduction to Relational Algebra .....................................................................................................9-3 Defining Relational Algebra ...............................................................................................................9-3 Selection ...........................................................................................................................................9-4 Projection..........................................................................................................................................9-5 Cartesian Product .............................................................................................................................9-6 Union................................................................................................................................................9-8 Difference........................................................................................................................................9-10 Intersection.....................................................................................................................................9-11 Joins...............................................................................................................................................9-12

EVAL

UAT

ION

CO

PY

vii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson 9 Review ..............................................................................................................................9-17 Lesson 9 Instructor Section.............................................................................................................9-19

Lesson 10: Transactions and Database Security......................................................................... 10-1 Pre-Assessment Questions ..............................................................................................................10-2 Introduction to Database Transactions and Security .......................................................................10-3 Transactions ...................................................................................................................................10-3 Concurrency Control .......................................................................................................................10-4 Database Security ...........................................................................................................................10-7 Case Study......................................................................................................................................10-9 Lesson 10 Review .......................................................................................................................... 10-12 Lesson 10 Instructor Section ......................................................................................................... 10-13

Course Assessment...........................................................................................Course Assessment-1 Appendixes ................................................................................................................. Appendixes-1 Glossary ...........................................................................................................................Glossary-1 Index ................................................................................................................................... Index-1 Supplemental CD-ROM Contents ................................................. Supplemental CD-ROM Contents-1

List of Labs Lab 3-1: Starting the ProAudio database...............................................................................................3-8 Lab 4-1: Creating an entity-relationship diagram ................................................................................4-10 Lab 4-2: Diagramming relationships and cardinality ...........................................................................4-12 Lab 5-1: Applying 1NF ..........................................................................................................................5-5 Lab 5-2: Determining functional dependencies and applying 2NF..........................................................5-9 Lab 5-3: Applying normalization .........................................................................................................5-11 Lab 6-1: Refining a data model .............................................................................................................6-9 Lab 6-2: Using a database definition language ....................................................................................6-11 Lab 6-3: Validating the logical data model...........................................................................................6-12 Lab 6-4: Determining integrity constraints..........................................................................................6-15 Lab 7-1: Creating base relations for the ProAudio database...................................................................7-9 Lab 7-2: Creating relations and adding CHECK constraints ................................................................7-17 Lab 7-3: Creating views.......................................................................................................................7-21 Lab 7-4: Creating users and granting privileges ..................................................................................7-24 Lab 8-1: Using DDL ..............................................................................................................................8-7 Lab 8-2: Using the INSERT statement ...................................................................................................8-9 Lab 8-3: Deleting and updating records ..............................................................................................8-10 Lab 8-4: Retrieving records from a database........................................................................................8-15 Lab 8-5: Using the IN, BETWEEN and LIKE operators.........................................................................8-19 Lab 9-1: Joining relations ...................................................................................................................9-15

List of Activities Activity 10-1: Analyzing transactions and concurrency control.......................................................... 10-15

List of Optional Labs Optional Lab 1-1: Using a flat-file database.........................................................................................1-14 Optional Lab 2-1: Using MySQL Query Browser ..................................................................................2-20 Optional Lab 3-1: Starting the ProRésumés database..........................................................................3-17 Optional Lab 4-1: Creating an entity-relationship diagram for ProRésumés .........................................4-20 Optional Lab 5-1: Normalizing the ProRésumés database....................................................................5-23 Optional Lab 5-2: Practicing normalization .........................................................................................5-24 Optional Lab 6-1: Refining and validating the ProRésumés database...................................................6-22 Optional Lab 7-1: Creating base relations, adding CHECK constraints and creating views for the ProRésumés database.........................................................................................................................7-35 Optional Lab 8-1: Manipulating data in the ProRésumés database ......................................................8-32 Optional Lab 9-1: Using relational algebra ..........................................................................................9-21

EVAL

UAT

ION

CO

PY

viii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

List of Quizzes Lesson 1 Quiz .....................................................................................................................................1-18 Lesson 2 Quiz .....................................................................................................................................2-28 Lesson 3 Quiz .....................................................................................................................................3-18 Lesson 4 Quiz .....................................................................................................................................4-21 Lesson 5 Quiz .....................................................................................................................................5-26 Lesson 6 Quiz .....................................................................................................................................6-24 Lesson 7 Quiz .....................................................................................................................................7-37 Lesson 8 Quiz .....................................................................................................................................8-34 Lesson 9 Quiz .....................................................................................................................................9-24 Lesson 10 Quiz ................................................................................................................................. 10-16

List of Figures Figure CS-1: Installing MySQL Server 5.0 ...........................................................Classroom Setup Guide-6 Figure CS-2: Install as a Windows service screen ................................................Classroom Setup Guide-7 Figure CS-3: Specifying security settings.............................................................Classroom Setup Guide-7 Figure CS-4: Ready to execute screen .................................................................Classroom Setup Guide-8 Figure CS-5: Installing MySQL 5.0 GUI tools.......................................................Classroom Setup Guide-8 Figure CS-6: Setup type screen...........................................................................Classroom Setup Guide-9 Figure OL1-1: Command prompt ........................................................................................................1-15 Figure OL1-2: Results of database manipulation.................................................................................1-16 Figure 2-1: Two-tier client-server architecture.......................................................................................2-3 Figure 2-2: Three-tier client-server architecture ....................................................................................2-4 Figure 2-3: Employee relation ...............................................................................................................2-5 Figure 2-4: Employee relation domains .................................................................................................2-5 Figure 2-5: Degree and cardinality of Employee relation........................................................................2-6 Figure 2-6: Department relation............................................................................................................2-7 Figure 2-7: Modified Employee relation .................................................................................................2-7 Figure 2-8: Employee and Department table relationships ....................................................................2-9 Figure 2-9: Example of strong entity ...................................................................................................2-11 Figure 2-10: Example of weak entity ...................................................................................................2-11 Figure IN2-1: Employee relation..........................................................................................................2-20 Figure OL2-1: MySQL Query Browser sign-in window .........................................................................2-21 Figure OL2-2: No Default Schema Specified dialog box........................................................................2-21 Figure OL2-3: MySQL Query Browser — main query window ..............................................................2-22 Figure OL2-4: Displaying relation attributes in Database browser .......................................................2-22 Figure OL2-5: Database browser shortcut menu .................................................................................2-23 Figure OL2-6: Interactive SQL window ................................................................................................2-23 Figure OL2-7: MySQL Table Editor......................................................................................................2-24 Figure OL2-8: Defining attributes in MySQL Table Editor....................................................................2-24 Figure OL2-9: Attributes of test_table defined .....................................................................................2-25 Figure OL2-10: Confirm Table Edit dialog box.....................................................................................2-25 Figure OL2-11: Executing a SELECT statement ..................................................................................2-26 Figure OL2-12: Loading data into a table ............................................................................................2-27 Figure 3-1: Simple data model ..............................................................................................................3-4 Figure 4-1: ProAudio table attributes ....................................................................................................4-3 Figure 4-2: Entity in ER or IE diagram..................................................................................................4-8 Figure 4-3: Chen ER model with attributes ...........................................................................................4-8 Figure 4-4: IE entity and attributes.......................................................................................................4-8 Figure 4-5: ER diagram indicating domains for attributes .....................................................................4-9 Figure 4-6: Chen ER diagram showing entity relationships .................................................................4-10 Figure 4-7: IE diagram showing relationships and cardinality .............................................................4-12 Figure IN4-1: Chen ER model with attribute information.....................................................................4-18 Figure IN4-2: IE model with attribute information ...............................................................................4-18 Figure IN4-3: ER models showing mandatory and optional relationships.............................................4-19 Figure IN4-4: ER model showing mandatory and optional relationship ................................................4-19 Figure 5-1: ProRentals relation .............................................................................................................5-4 Figure 5-2: ProRentals relation in 1NF ..................................................................................................5-4

EVAL

UAT

ION

CO

PY

ix

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Figure 5-3: ProRentals relation, 1NF anomalies.....................................................................................5-5 Figure 5-4: ProRentals Rental_Info relation ...........................................................................................5-8 Figure 5-5: ProRentals Customer_Info relation ......................................................................................5-8 Figure 5-6: ProRentals Owner_Info relation ...........................................................................................5-8 Figure 5-7: ProAudio relation, 2NF........................................................................................................5-9 Figure 5-8: New Owner_Info relation ...................................................................................................5-10 Figure 5-9: ProRentals Property_Info relation ......................................................................................5-10 Figure 5-10: ProRentals relations with primary and foreign keys .........................................................5-11 Figure 5-11: ProRentals Assistant relation ..........................................................................................5-11 Figure 5-12: ProRentals Location_Manager relation.............................................................................5-12 Figure 5-13: Four ProRentals relations................................................................................................5-13 Figure 5-14: ProRentals Client_Meeting relation..................................................................................5-13 Figure 5-15: BCNF relations for Client_Meeting relation ......................................................................5-14 Figure IN5-1: ProRentals relation ........................................................................................................5-21 Figure IN5-2: Instructor and Inst_Courses relations............................................................................5-21 Figure IN5-3: Instructor, Inst_Courses and Department relations........................................................5-22 Figure IN5-4: Employees relation ........................................................................................................5-22 Figure IN5-5: Employees and Employee_Group relations.....................................................................5-22 Figure IN5-6: Supplier_Parts relation ..................................................................................................5-23 Figure IN5-7: Supplier_Parts and Supplier relations............................................................................5-23 Figure 6-1: Managers and Locations relations .......................................................................................6-4 Figure 6-2: Managers and Employees relations .....................................................................................6-4 Figure 6-3: Students and Classes relations ...........................................................................................6-4 Figure 6-4: Students, Enrollments, and Classes relations .....................................................................6-5 Figure 6-5: Complex relationship ..........................................................................................................6-5 Figure 6-6: Intermediate entity resolves complex relationship................................................................6-6 Figure 6-7: Recursive relationship.........................................................................................................6-6 Figure 6-8: New entity resolves recursive relationship ...........................................................................6-6 Figure 6-9: Relationship with attribute..................................................................................................6-7 Figure 6-10: Resolving relationship with attribute .................................................................................6-7 Figure 6-11: Examining data model for redundant relationships ...........................................................6-8 Figure 6-12: Sample relationship ........................................................................................................6-13 Figure 7-1: MySQL Query Browser sign-in window................................................................................7-5 Figure 7-2: MySQL Query Browser — main query window.....................................................................7-6 Figure 7-3: Displaying relations and attributes .....................................................................................7-6 Figure 7-4: Query toolbar......................................................................................................................7-7 Figure 7-5: Advanced toolbar and Composer buttons ............................................................................7-7 Figure 7-6: Main query window — query area maximized ......................................................................7-8 Figure 7-7: Default Schema Does Not Exist dialog box ..........................................................................7-9 Figure 7-8: ProAudio database created................................................................................................7-10 Figure 7-9: Creating new table in ProAudio database ..........................................................................7-10 Figure 7-10: Adding attributes to table................................................................................................7-11 Figure 7-11: Distributors table attributes............................................................................................7-12 Figure 7-12: Confirm Table Edit dialog box .........................................................................................7-12 Figure 7-13: SQL statement for Customers relation.............................................................................7-13 Figure 7-14: Customers table in Table Editor ......................................................................................7-14 Figure 7-15: ProRentals Property_Info relation ....................................................................................7-19 Figure 7-16: ProRentals Owner_Info relation .......................................................................................7-19 Figure 7-17: Modified Property_Info relation........................................................................................7-20 Figure 7-18: Employee relation ...........................................................................................................7-21 Figure 7-19: Enter View Name dialog box............................................................................................7-22 Figure 7-20: MySQL Administrator main screen..................................................................................7-24 Figure 7-21: MySQL Administrator Options dialog box — Administrator screen...................................7-25 Figure 7-22: User information tabs .....................................................................................................7-25 Figure 7-23: Schema Object Privileges tab...........................................................................................7-26 Figure 7-24: Assigning privileges to a user ..........................................................................................7-27 Figure 8-1: Employee relation ...............................................................................................................8-7 Figure 8-2: Employee relation .............................................................................................................8-12 Figure 8-3: Orders relation..................................................................................................................8-13 Figure 8-4: Modified Orders relation....................................................................................................8-18 Figure 8-5: ProConference relations ....................................................................................................8-22

EVAL

UAT

ION

CO

PY

x

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Figure IN8-1: NL_Hitters and AL_Hitters relations ...............................................................................8-30 Figure IN8-2: Sales_Info and Customer_Info relations .........................................................................8-31 Figure 9-1: Selection.............................................................................................................................9-4 Figure 9-2: Employee relation ...............................................................................................................9-4 Figure 9-3: Result of selection operation ...............................................................................................9-5 Figure 9-4: Projection ...........................................................................................................................9-5 Figure 9-5: Result of projection operation..............................................................................................9-6 Figure 9-6: Result of nested operation...................................................................................................9-6 Figure 9-7: Cartesian product ...............................................................................................................9-6 Figure 9-8: Employee and Customer relations.......................................................................................9-7 Figure 9-9: Cartesian product of Employee and Customer relations ......................................................9-7 Figure 9-10: Restricted Cartesian product of Employee and Customer relations ....................................9-8 Figure 9-11: Union ...............................................................................................................................9-8 Figure 9-12: Employee1 and Employee2 relations .................................................................................9-9 Figure 9-13: Union of Employee relations..............................................................................................9-9 Figure 9-14: Difference .......................................................................................................................9-10 Figure 9-15: Set difference for Employee1 and Employee2 relations ....................................................9-10 Figure 9-16: Intersection.....................................................................................................................9-11 Figure 9-17: Intersection of Employee1 and Employee2 relations ........................................................9-11 Figure 9-18: Customer relation ...........................................................................................................9-13 Figure 9-19: Orders relation................................................................................................................9-13 Figure 9-20: Equi-join of Customer and Orders relations ....................................................................9-13 Figure 9-21: Natural join of Customer and Orders relations ................................................................9-14 Figure 9-22: Left outer join of Customer and Orders relations .............................................................9-15 Figure IN9-1: Employee and Customer relations .................................................................................9-20 Figure IN9-2: Result of Cartesian product with renamed attribute.......................................................9-20 Figure OL9-1: Student Grade relation .................................................................................................9-21 Figure OL9-2: Student Info relation.....................................................................................................9-22 Figure OL9-3: NL_Hitters and AL_Hitters relations ..............................................................................9-22 Figure OL9-4: Location and Property relations ....................................................................................9-23 Figure OL9-5: Customer and Showings relations.................................................................................9-23 Figure IN10-1: Typical DBMS transactional architecture ................................................................... 10-14

List of Tables Table 3-1: DBMS selection criteria ......................................................................................................3-10 Table 3-2: GUI considerations.............................................................................................................3-11 Table 4-1: Employee/Location relation..................................................................................................4-4 Table 4-2: Employee relation.................................................................................................................4-5 Table 4-3: Location relation ..................................................................................................................4-5 Table 5-1: Parent relation .....................................................................................................................5-5

EVAL

UAT

ION

CO

PY

xi

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Course Description The Database Design Specialist course (formerly titled Database Design Methodology) teaches students how to plan and design relational databases. You will learn about the theory behind relational databases, relational database nomenclature, and relational algebra. The course includes sections on Structured Query Language (SQL) and optimizing databases through normalization. You will apply your knowledge with hands-on labs designed to teach the intricacies of database design methodology.

Database Design Specialist offers Case Studies for class discussion about real-world skills applications. The CIW Database Design Specialist course prepares students to take the CIW Database Design Specialist certification exam.

Guided, step-by-step labs provide opportunities to practice new skills. You can challenge yourself and review your skills after each lesson in the Lesson Summary and Lesson Review sections. Additional skill reinforcement is provided in Optional Labs, Lesson Quizzes, an Activity and a Course Assessment that are available from your instructor.

This coursebook includes supplemental material located on CIW Online. To practice the skills presented in class or to perform any labs that were not completed, refer to the Classroom Setup section for information about system requirements and using the lab files.

Series Database Design Specialist is the third course in the CIW Web Development series:

• JavaScript Specialist

• Perl Specialist

• Database Design Specialist

Prerequisites It is recommended that students have a basic knowledge of the purpose and function of a database. Also, students should be familiar with an operating system such as Microsoft Windows XP before taking this course. The Database Design Specialist courseware does not provide entry-level computer literacy.

Certification The Database Design Specialist course helps prepare students to take the high-stakes CIW Database Design Specialist certification exam (1D0-541). Those who pass the Database Design Specialist exam, the CIW JavaScript Specialist exam (1D0-435) and the CIW Perl Specialist exam (1D0-437) earn the highly respected CIW Web Development Professional certification, which is recognized throughout the industry as validating essential knowledge and skills in a specific IT discipline. For information about taking CIW exams, visit www.CIWcertified.com.

Target audience The CIW Database Design Specialist course is for individuals who want introductory vendor-neutral database training and who plan to pursue product-focused database specialization:

• IT managers/directors

• Application developers

• Web development professionals

• Software programmers

EVAL

UAT

ION

CO

PY

xii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

• Enterprise developers

• Database designers/administrators

Courseware This coursebook was developed for instructor-led training and will assist you during class. Along with comprehensive instructional text and objectives checklists, this coursebook provides easy-to-follow hands-on labs and a glossary of course-specific terms. It also provides Internet addresses needed to complete some labs, although due to the constantly changing nature of the Internet, some addresses may no longer be valid.

The student coursebook is organized in the following manner:

course title

table of contents

list of labs

list of figures

list of tables

appendixes

lessons

lesson objectives

narrative text

supplemental movie clips

lesson review

lesson summary

warnings

tech notes

graphics

tables and figures

pre-assessment questions

glossary

index

case study

exam objective callouts

warnings

tech notes

graphics

tables and figures

exam objective callouts

labs

supplemental files

When you return to your home or office, you will find this coursebook to be a valuable resource for reviewing labs and applying the skills you have learned. Each lesson concludes with questions that review the material. Lesson review questions are provided as a study resource only and in no way guarantee a passing score on the CIW Database Design Specialist certification exam.

Coursebook versions The Database Design Specialist courseware is designed for various classroom environments: academic, learning center and corporate. These coursebooks are available in both instructor and student versions. Student versions are available for both the academic environment and the learning center/corporate environment. Check your book to verify which version you have.

EVAL

UAT

ION

CO

PY

xiii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

• Instructor (Academic, Learning Center and Corporate) — Example syllabi for 10-week and 16-week instruction periods are included with the instructor supplemental files available on CIW Online. Learning centers can teach this series at an accelerated pace; consult the implementation tables that can be found on CIW Online. The supplemental files also include an appendix listing the CIW Database Design Specialist certification exam objectives and locations of corresponding material in the coursebook. The instructor version of this book includes Instructor Notes in the margin, which provide additional tips and commentary for the instructor to supplement course narrative. Margin callouts also direct instructors to material that relates directly to specified CIW Database Design Specialist exam objectives. The instructor book and supplemental files contain all answers to Activities (pen-and-paper-based), Optional Labs (computer-based), Lesson Quizzes and the Course Assessment. The supplemental files also include handout versions of all Activities, Optional Labs, Lesson Quizzes and the Course Assessment, which the instructor can print and assign during class or as homework. Lesson Quizzes and Course Assessments are provided as study and course-grading resources only; success on these materials in no way guarantees a passing score on the Database Design Specialist certification exam.

• Student (Academic) — The student book and supplemental files include Pre-Assessment and Lesson Review questions for each lesson. However, the student book does not provide answers to these questions. It also does not include any Activities, Optional Labs, Quizzes or the Course Assessment. Students can obtain these elements and answers only from the instructor. The student supplemental materials include appendixes and files used to perform many of the labs in the coursebook. The supplemental files also include an appendix listing the Database Design Specialist certification exam objectives and locations of corresponding material in the coursebook. Lesson Quizzes and Course Assessments are provided as study and course-grading resources only; success on these materials in no way guarantees a passing score on the Database Design Specialist certification exam.

• Student (Learning Center/Corporate) — Designed for the learning center/corporate environment, this student book includes Pre-Assessment and Lesson Review questions. The student supplemental materials include appendixes; files used to perform many of the labs in the coursebook; and answers to the Pre-Assessment Questions, Lesson Review Questions, Course Assessment, Activities, Optional Labs and Lesson Quizzes. The supplemental files also include an appendix listing the Database Design Specialist certification exam objectives and locations of corresponding material in the coursebook. Lesson Quizzes and Course Assessments are provided as study and course-grading resources only; success on these materials in no way guarantees a passing score on the Database Design Specialist certification exam.

Online resources You can visit CIW Online at http://education.certification-partners.com/ciw/ to access supplemental course materials and to get help in preparing for the CIW Database Design Specialist certification exam. CIW Online provides a variety of online tools you can use to supplement the Official CIW Courseware.

CIW courseware supplemental files This coursebook includes supplemental material that can be accessed from CIW Online. Online materials are provided for both instructors and students, and include some elements required to complete the coursework and other optional elements that are provided for your interest or further study. Student materials include lab files used to complete the course labs, answers to student exercises and quizzes, and appendixes with related information (including the Database Design Specialist Objectives And Locations Appendix). Instructor materials include course syllabi and implementation tables, answers to students exercises and quizzes, and appendixes with related information (including the Database Design Specialist Objectives And Locations Appendix). See the CIW Supplemental Files section under Classroom Setup for information about accessing these files.

EVAL

UAT

ION

CO

PY

xiv

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

CIW Online Exercises These interactive activities are instructional supplements to the official print and online books, designed to offer a blended-learning approach. Mapped directly to the Official CIW Courseware, the CIW Online Exercises enable you to review important concepts from the course and measure your proficiency on content relevant to CIW certification exams. CIW Online Exercises challenge you with a wide range of activities including glossary flashcards, matching exercises, fill-in-the-blank exercises, crossword puzzles and true/false questions — all providing immediate feedback.

CIW Course Reviews CIW Course Reviews are designed to assess your knowledge of the concepts, skills and best practices of Web technology taught in the Official CIW Courseware. The CIW Course Reviews assess lesson knowledge, reinforce classroom learning and enhance instruction. This online review program contains multiple-choice reviews and quizzes that cover courseware content lesson by lesson.

CIW Certification Practice Exams After you have mastered the Database Design Specialist course material, you are ready to prepare for the high-stakes CIW Database Design Specialist certification exam. The online CIW Certification Practice Exams program helps build confidence with your knowledge of the CIW exam objectives. This program provides you with:

• Timed practice exams that simulate the high-stakes testing environment and help predict actual performance on the CIW exams.

• A feedback review mode that allows you to check answers while taking the practice exam and gain valuable feedback that relates each question to a CIW exam objective and a lesson in the Official CIW Courseware.

• Exam results that report on your mastery of each CIW exam objective.

• Personalized performance reports and study plans to track individual progress and view overall class trends.

Course Objectives After completing this course, you will be able to:

Define and describe database management systems (DBMSs), and identify the advantages and disadvantages of using a DBMS.

Define relational model terminology, and describe relational tables and their characteristics.

Explain the database design life cycle, and discuss the various aspects of database planning.

Describe relational database design methodology, and discuss the phases of database design.

Discuss the normalization process, and describe normal forms.

Identify design issues related to logical and physical database design, use database definition languages, define and use Structured Query Language (SQL), and identify SQL commands and syntax.

Define relational algebra, and explain concepts related to relational algebra.

Define transactions and identify database protection and security techniques.

Classroom Setup Your instructor has probably set up the classroom computers based on the system requirements listed in the following sections. Most software configurations on your computer are identical to those on your

EVAL

UAT

ION

CO

PY

xv

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

instructor's computer. However, your instructor may use additional software to demonstrate network interaction or related technologies.

System Requirements This section lists the hardware, software and connectivity requirements to implement this course.

Hardware Each classroom should be equipped with an individual computer workstation for each student and the instructor. The following table summarizes the hardware requirements for all courses in the CIW program.

Note: The CIW hardware requirements are similar to the minimum system requirements for Microsoft Windows XP Professional Service Pack 2 implementation.

Hardware Specifications Minimum Requirements Processor Intel Pentium III processor (or equivalent) with 300-MHz

processor clock speed recommended; 233-MHz minimum required (single or dual processor system)

L2 cache 256 KB

Hard disk 8 GB

RAM At least 128 MB

CD-ROM 32X

Network interface card (NIC) 10BaseT or 100BaseTX (10 or 100 Mbps)

Video adapter 4 MB

Monitor Super VGA (800 x 600) resolution video graphics card and 17-inch monitor with 256 colors

Software The recommended software configurations for computers used to perform the labs in this book are as follows.

To be installed before class:

• Microsoft Windows XP Professional Service Pack 2 (typical installation)

• MySQL 5.0 Community Server — The MySQL 5.0 DBMS is available in the Lab Files section of the Supplemental Files. The name of the file is: mysql-essential-5.0.90-win32.zip. A Windows implementation of the md5 command line utility is available from www.fourmilab.ch/md5. A graphical MD5 checking tool is also available from http://nullriver.com/products.

• MySQL 5.0 GUI Tools (typical installation) — The MySQL GUI Tools package is available in the Lab Files section of the Supplemental Files. The name of the file is: mysql-gui-tools-5.0-r17-win32.zip.

Connectivity Internet connectivity is required for this course. You will experience optimal performance with a dedicated Internet connection (e.g., a cable/DSL modem or a T1 line). However, you can teach the course using slower connections (e.g., 56-Kbps modem).

EVAL

UAT

ION

CO

PY

xvi

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

CIW supplemental files This coursebook includes supplemental materials that are referenced and used throughout the course. These supplemental materials are provided online at http://education.certification-partners.com/ciw/.

You will need to create a directory for all supplemental materials for the course. The default location is C:\CIW\[Course_Title]. To view or download the materials, go to CIW Online, click the link for each file and save to this directory. You can then create a shortcut to this directory on your Desktop. As you conduct the course labs, you can use this shortcut to quickly access your lab files.

EVAL

UAT

ION

CO

PY

xvii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Conventions and Graphics Used in This Book The following conventions are used in these coursebooks.

Terms Technology terms defined in the margins are indicated in bold type the first time they appear in the text. However, not every word in bold type is a term requiring definition.

Lab Text Text that you enter during a lab appears in italic bold type. Names of components that you access or change in a lab appear in bold type.

Notations Notations or comments regarding screenshots, labs or other text are indicated in italic type.

Program Code or Commands

Text used in program code or operating system commands appears in the Lucida Sans Typewriter font.

The following graphics are used in these coursebooks.

Tech Notes point out exceptions or special circumstances that you may find when working with a particular procedure. Tech Notes that occur within a lab are displayed without the graphic.

Tech Tips offer special-interest information about the current subject.

Warnings alert you about cautions to observe or actions to avoid.

This graphic signals the start of a lab or other hands-on activity.

Each lesson summary includes an Application Project. This project is designed to provoke interest and apply the skills taught in the lesson to your daily activities.

Each lesson concludes with a summary of the skills and objectives taught in that lesson. You can use the Skills Review checklist to evaluate what you have learned.

This graphic indicates a line of code that is completed on the following line.

EVAL

UAT

ION

CO

PY

xviii

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-1

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Classroom Setup Guide The Classroom Setup Guide is divided into three sections:

1. Before You Begin — This section includes courseware update links for instructors, a revision history outlining the revisions made to a coursebook since the last version, an explanation of the requirements for preparing a classroom behind a proxy server, and additional notes that you should consider before you set up the classroom.

2. Classroom Requirements — This section lists the hardware, software and connectivity requirements to implement this course.

3. Setup Instructions — This section includes the configuration requirements for both instructor and student systems and a detailed list of required software installation procedures.

Before You Begin This section includes courseware update links for instructors, a revision history outlining the revisions made to a coursebook since the last version, an explanation of the requirements for preparing a classroom behind a proxy server, and additional notes that you should consider before you set up the classroom.

Courseware updates Instructors must download the latest courseware updates from the Instructor Community on the CIW Web site (www.CIWcertified.com) before teaching the course. CIW courseware is updated continually, and the courseware updates provide the most current changes, revisions and notes for all CIW courseware.

Courseware updates include feedback from Authorized Training Partners (ATPs) and Authorized Academic Partners (AAPs), clients and instructors who implement the CIW program. Feedback is reviewed and updates are posted in dynamic documents for both students and instructors. Each updates document correlates with the identical version of the coursebook (e.g., v1.0 Update is designed to be used only with version 1.0 of the coursebook). Updates are available for both the current versions and the immediately previous versions of the coursebooks. CIW does not provide support for coursebooks and instructor materials that are two or more versions removed from the current versions.

Revision history

Released March 2011 (Database Design Specialist version 1.0) This release reflects a name change to the coursebook. The main differences between this Database Design Specialist v1.0 course and the previous version, Database Design Methodology v3.0 (released February 2008) are as follows:

• Coursebook title was changed from Database Design Methodology to Database Design Specialist to mirror the Database Design Specialist exam name.

• Discontinued the supplemental CD-ROM and removed the handouts from the coursebook, and made these files available on CIW Online.

Released February 2008 (Database Design Methodology version 3.0) This release is considered a course revision. The main differences between Database Design Methodology v3.0 and the previous version (v2.1 released March 2003) are as follows:

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-2

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

• Labs standardized to Windows XP Professional

• Case Studies that discuss real-life applications of skills added

• Labs and Optional Labs updated to use MySQL 5.0 Community Server and MySQL 5.0 GUI Tools, replacing Borland Interbase, which is no longer available

• Objective callouts added to sections of the book that correspond to the revised exam objectives for the CIW v5 Database Specialist exam

Released March 2003 (Database Design Methodology version 2.1) This release is considered a course enhancement. The main differences between Database Design Methodology v2.1 and the previous version (v2.07 released June 2002) are as follows:

• Applied new publishing template to course for more professional look and feel

• Entered corrections to errata (an error in writing or printing, including but not limited to spelling, style, and code errors)

Released June 2002 (Database Design Methodology version 2.07) This release was considered a course enhancement. The main differences between Database Design Methodology v2.07 and the previous version (v1.17 released August 2001) are as follows:

• Introduced separate instructor and student guides

• Added pre-assessment questions

• Added instructor margin notes

• Enhanced lesson summaries

• Added instructor section containing optional labs and quizzes

• Introduced syllabi (for academic instructors) and implementation tables (for learning center instructors)

• Incorporated instructor feedback and errata

Preparing the classroom behind a proxy server If Internet access is required (or preferred) for a class and the classroom is behind a proxy server, you may have problems downloading programs during classroom setup and completing certain labs during class. Most proxy servers already allow HTTP traffic. Difficulties may occur when you require additional services, such as e-mail, FTP, and program downloads.

The following two suggestions are offered.

1. Talk with the network administrator at the location and make sure that:

a. The classroom has proper access to all Internet-related protocols used in the class. Examples include HTTP (TCP/UDP port 80), SSL (TCP/UDP port 443), FTP (TCP/UDP port 20, 21), Telnet (TCP/UDP port 23), POP3 (TCP/UDP port 110), SMTP (TCP/UDP port 25) and NNTP (TCP/UDP port 119). For certain services, such as FTP, you will need all ports above 1023 (registered ports).

b. The IP addresses assigned to the computers in your classroom have permission to access the Internet.

2. Download all the required software (with proper licensing) for the course before you arrive at the site, and place the source files on the instructor computer. Students can then access all source files from

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-3

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

shares that you create. Consider creating a CD with the required software source files. This will not solve the issues addressed in Suggestion 1, but will solve any download problems.

Classroom Requirements This section lists the hardware, software and connectivity requirements to implement this course. Before class, the instructor should install and configure the instructor and student systems using the following instructions.

Hardware Each classroom should be equipped with an individual computer workstation for each student and the instructor. The following table summarizes the hardware requirements for all courses in the CIW program.

Note: The CIW hardware requirements are similar to the minimum system requirements for Microsoft Windows XP Professional Service Pack 2 implementation.

Hardware Specifications Minimum Requirements Processor Intel Pentium III processor (or equivalent) with 300-MHz

processor clock speed recommended; 233-MHz minimum required (single or dual processor system)

L2 cache 256 KB

Hard disk 8 GB

RAM At least 128 MB

CD-ROM 32X

Network interface card (NIC) 10BaseT or 100BaseTX (10 or 100 Mbps)

Video adapter 4 MB

Monitor Super VGA (800 x 600) resolution video graphics card and 17-inch monitor with 256 colors

Software Install the following software on the classroom systems. The instructor and student configurations are identical.

To be installed before class:

• Microsoft Windows XP Professional Service Pack 2 (typical installation)

• MySQL 5.0 Community Server (typical installation) — The MySQL 5.0 DBMS is available in the Lab Files section of the Supplemental Files. The name of the file is: mysql-essential-5.0.90-win32.zip. A Windows implementation of the md5 command line utility is available from www.fourmilab.ch/md5. A graphical MD5 checking tool is also available from http://nullriver.com/products.

• MySQL 5.0 GUI Tools (typical installation) — The MySQL GUI Tools package is available in the Lab Files section of the Supplemental Files. The name of the file is: mysql-gui-tools-5.0-r17-win32.zip.

Connectivity Internet connectivity is required for this course. You will experience optimal performance with a dedicated Internet connection (e.g., a cable/DSL modem or a T1 line). However, you can teach the course using slower connections (e.g., 56-Kbps modem).

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-4

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Setup Instructions Use the following procedures to set up the computers for class.

To set up the hardware Set up the hardware according to the manufacturer's instructions. (Refer to the requirements listed in the Hardware section of this Classroom Setup Guide.)

To install and configure Microsoft Windows XP Professional Service Pack 2 Install Windows XP Professional Service Pack 2 with the default settings. The only requirements are:

• Systems must be able to access the Internet in order for students to perform some of the hands-on labs and application projects.

The instructions for installing Windows XP Professional Service Pack 2 are as follows:

1. Obtain a valid license for all copies of Windows XP Professional Service Pack 2.

2. Begin setup by setting the boot sequence for your computer so that it will boot from the CD drive, then insert the Windows XP Professional CD-ROM and reboot.

3. Accept the licensing agreement by pressing F8.

4. Use the following parameters to perform a typical installation of Windows XP Professional SP2 (if installing Windows XP Professional, go to the Microsoft Web site after installation to download and install Service Pack 2).

When This Information Is Required Use

Phase 1

Partition Location Default (C:)

Partition Size Entire hard drive

Partition File System NTFS

Location Default (C:\windows)

Phase 2

Regional and Language Options Customize for your location

Name Your name

Organization Your organization

Product Key The CD key for your copy of Windows XP Professional

Licensing Modes Per server

Concurrent Connections At least the number of student computers in the classroom

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-5

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

When This Information Is Required Use

Computer Name Instructor or StudentX (where X is the assigned student number, such as Student13) Note: If several classrooms are connected, you may encounter name conflicts. If so, add a number or letter to the name. For example, name the instructor computer instructor1 and a student13 computer student13a.

Type Administrator Password password (all lowercase letters)

Confirm Password password (all lowercase letters)

Date and Time Settings Customize for your location

Network Settings (Custom or Typical)

Typical

Workgroup or Domain Workgroup Select No, This Computer Is Not On A Network, Or Is On A Network Without A Domain. In the Workgroup Or Computer Domain field, enter Classroom. Note: If several classrooms are connected, you may encounter name conflicts. If so, add a number to the name. For example, name the workgroup Classroom1.

Verification Verify that the system is working and that it can communicate with other systems in the classroom.

To install Service Pack 2, go to the Microsoft Download Center at http://www.microsoft.com/downloads , and download and install Service Pack 2. Service Pack 2 includes several security enhancements and a firewall. All labs have been written to Service Pack 2. If you do not install Service Pack 2, some labs may not work as stated.

Configure Windows XP Professional Service Pack 2 for use in your classroom by specifying the following settings:

• Specify valid IP addresses:

1. Log on as Administrator.

2. Select Start | Control Panel, then double-click Network Connections.

3. Right-click your LAN connection, then click Properties to open the Local Area Connection Properties dialog box.

4. In the list box, click Internet Protocol (TCP/IP), then click Properties to open the Internet Protocol (TCP/IP) Properties dialog box.

5. Select Use The Following IP Address, then manually enter the IP address information specific to this classroom. You can use DHCP if you prefer; however, prepare the system for networking.

Note: Do not enter DNS configurations unless you have a DNS server.

6. Click OK, click Close, then close the Network Connections window.

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-6

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

• Specify the CLASSROOM workgroup:

1. Select Start | Control Panel, then double-click System to open the System Properties dialog box.

2. Click the Computer Name tab, then click the Change button.

3. In the Member Of section, select the text in the Workgroup field, type classroom, click OK four times, then click Yes to restart.

Note: If several classrooms are connected, you may encounter name conflicts. If so, add a number to the name. For example, name the workgroup Classroom1.

• Open port 3306 through the Windows XP firewall on each system in the classroom:

1. Select Start | Control Panel, then double-click Windows Firewall to open the Windows Firewall dialog box.

2. Click the Exceptions tab, then click the Add Port button to open the Add A Port dialog box.

3. In the Name box, type MySQL, in the Port Number box, type 3306. Ensure that TCP is selected, then click OK twice.

4. Close the Control Panel.

Network requirements Classroom computers should be part of the same local area network (LAN). This class also requires Internet access. Following are two options available to you.

1. Obtain valid IP addresses from a DHCP server.

2. If no DHCP server is available, obtain TCP/IP configurations from the network administrator and manually configure each system.

To install MySQL 5.0 Community Server 1. In the supplemental files, double-click mysql-essential-5.0.90-win32.zip to open the MySQL Setup

Wizard (shown in Figure CS-1) and begin the installation process.

Figure CS-1: Installing MySQL Server 5.0

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-7

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

2. Click Next twice to specify a typical installation, then click Install.

3. Click Next twice to bypass information about MySQL Enterprise edition, ensure that Configure The MySQL Server Now option is selected, then click Finish. This step completes the installation and launches the Configuration Wizard.

4. Click Next, ensure that Standard Configuration is selected, then click Next.

5. Ensure that Install As Windows Service is selected, that MySQL displays in the Service Name box, and that the Launch The MySQL Server Automatically option is selected, as shown in Figure CS-2.

Figure CS-2: Install as a Windows service screen

6. Click Next to view the Security Settings screen, shown in Figure CS-3.

Figure CS-3: Specifying security settings

7. Type masterkey in the New Root Password box, press TAB, type masterkey in the Confirm box, then click Next. The Ready To Execute screen appears, as shown in Figure CS-4.

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-8

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Figure CS-4: Ready to execute screen

8. Click Execute to start the configuration, then click Finish to complete the configuration.

To install MySQL 5.0 GUI Tools 1. In the supplemental files, double-click mysql-gui-tools-5.0-r17-win32.zip to open the MySQL GUI

Tools Setup Wizard (shown in Figure CS-5) and begin the installation process.

Figure CS-5: Installing MySQL 5.0 GUI tools

2. Click Next, select I Accept The Terms In The License Agreement, then click Next twice.

3. In the Setup Type screen, shown in Figure CS-6, ensure that Complete is selected, then click Next.

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-9

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Figure CS-6: Setup type screen

4. Click Install, click Next twice, then click Finish.

Configure MySQL 5.0 GUI Tools for use in the classroom:

1. Select Start | All Programs | MySQL | MySQL Query Browser.

2. Select Tools | Options, ensure that Browser is selected in the Category list, and select Show Advanced Toolbars and Show Composer Buttons Toolbar.

3. Click Apply, then click Close.

4. Select File | Exit.

CIW supplemental files Each coursebook includes supplemental materials that are referenced and used throughout the course. These supplemental materials are provided online at http://education.certification-partners.com/ciw/.

You will need to create a directory for all supplemental materials for the course. The default location is C:\CIW\[Course_Title]. To view or download the materials, go to CIW Online, click the link for each file and save to this directory. You can then create a shortcut to this directory on your Desktop. As you conduct the course labs, you can use this shortcut to quickly access your lab files.

EVAL

UAT

ION

CO

PY

Classroom Setup Guide-10

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

EVAL

UAT

ION

CO

PY

1Lesson 1: Introduction to Databases Objectives By the end of this lesson, you will be able to:

1.1.1: List database types (e.g., flat file, relational), and identify their uses and architectures.

1.1.2: Describe the types of database management system (DBMS), and explain the benefits and limitations of each DBMS type.

3.2.2: Analyze and select appropriate database designs, and identify the solution that addresses the application needs.

EVAL

UAT

ION

CO

PY

1-2 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Pre-Assessment Questions 1. Which of the following lists problems associated with file-based data systems?

a. Repetition of data, separation of data, incompatibility of files, data dependence b. Separation of data, incompatibility of files, data dependence, application

program flexibility c. Centralization of data, incompatibility of files, data dependence, application

program inflexibility d. Separation of data, incompatibility of files, data independence, application

program flexibility

2. When discussing the advantages and disadvantages of a database management system (DBMS), to what does increased data integrity refer?

a. It refers to the DBMS's ability to provide synchronized updates to redundant data.

b. It refers to the DBMS's ability to provide data sharing mechanisms. c. It refers to the DBMS's ability to provide mechanisms to define data types in tables

and to enforce constraints on data. d. It refers to the DBMS's ability to provide data access concurrency.

3. What are four questions that should be answered when an enterprise is determining the appropriate type of database?

How much data is going to be stored in the database? How much and how fast will the

data grow? Can the data be represented in a tabular format? How often does the data

need to be accessed? Are there multiple sets of data that contain related data, and is

there a need to run complex manipulations of the data? Will more than one person ever

need access to the data at one time? How fast and how reliable does the data system

need to be? Does the data system need to support transactions?

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-3

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Introduction to Databases Databases have long been a major part of the scientific and business environments, and database technology research and development has been an important aspect of software development in recent years. Database development breakthroughs have often acted as a catalyst for other significant developments in software engineering. Databases have become an important part of our day-to-day lives; in fact, we are often unaware that we are using a database.

Businesses rely on their database systems for mission-critical information. That information must be complete, up-to-date, accurate, and organized in a manner that permits easy data retrieval. And that data must be able to be formatted in particular ways according to the needs of each user. Properly designed databases and database application programs are essential for timely and accurate data retrieval.

The goal of this course is to introduce the concepts and design methodologies behind relational databases. This lesson will focus on defining the terms database and relational database. It will also briefly look at different types of databases, and will define database management system (DBMS).

What Is a Database? A database is a formally arranged set of persistent information stored by a computer program. Formally arranged means that the information is structured in some particular way. Persistent information means that the data remains intact after the program that accessed the information has ended. Most database systems offer the ability to manage the data as well as access it. This concept will be covered later in this lesson.

Several different types of databases have been used over the years. Many older databases were defined in a hierarchical manner, or were structured as networks of information. The most popular type of database today is the relational database. Relational databases are the focus of this coursebook and will be defined later in this lesson.

File-Based Databases One of the primary purposes of computers is the storage of information. From mainframe computers to desktop computers, many different types of data storage systems have been devised. File-based data storage systems were probably the earliest attempt at computerizing the traditional manual filing system that was prevalent before computers began to be used. They were also the most common type of data storage system prior to today's database systems. File-based data storage systems were created to address the need for more efficient data access. A file-based system is one in which a collection of application programs interact with data held in various files, performing such services as the creation of reports. These types of systems are often referred to as flat-file databases. A flat-file database is a file in which data is collected in lines of text, with each value separated by a tab character or a comma and with each row represented by a new line. This type of flat-file may also be referred to as a comma-separated values (CSV) file. These systems generally used a decentralized approach: Each department in an organization would be responsible for the management of its own data.

These types of systems inevitably cause several problems, including repetition of data, separation of data, incompatibility of files, data dependence, and inflexibility of the application programs that access the data. These problems will be discussed in the following sections.

INSTRUCTOR NOTE: Many examples are available when discussing the day-to-day use of databases. For instance, when a purchase is made at a retail store, a bar code for the item is scanned. The bar code reader is linked to a database program that in turn accesses a database to determine the cost of the item. Challenge students to think of other everyday scenarios in which databases are commonly used.

database A collection of data organized to provide efficient management of the data as well as easy access to and updating of the data.

flat-file database A file containing records that have no structured interrelationship.

OBJECTIVE: 1.1.1: Database types

EVAL

UAT

ION

CO

PY

1-4 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Repetition of data When data is duplicated in a system, it is much more difficult to maintain the integrity of that data. When the data is changed in one location, it must also be changed everywhere else that the data exists. In a decentralized environment, this can be difficult at best. If the changes are not performed in all the proper locations, data becomes inconsistent and ultimately unusable. Also, because the data exists in several locations, the data must be entered more than once. This is time-consuming and wasteful. And because the data is duplicated, it requires more storage space to maintain it.

Separation of data When data is held in disparate files, accessing related data becomes much more difficult. In the simplest of situations, information may be held in two different files that need to be accessed simultaneously, with operations performed and resulting data returned. The application must synchronize the processing of the two files to ensure that the correct information is returned. This situation becomes more complex as the number of files that need to be accessed grows.

Incompatibility of files The structure of the data storage files usually becomes embedded in the application programs that access them. In many situations, different programming languages may be used to structure the data, with the resulting files dependent on the particular language used to create them. An application programmer might thus be required to write programs that convert the files to some common format so that they can be processed. This is a time-consuming, expensive, and inefficient approach to processing data.

Data dependence As mentioned previously, the structure of data storage files is often defined within the application code that manipulates the files. In other words, the data and its structure depend on the application program that accesses it. This fact makes changing the existing structure of the data storage files difficult. Not only must a program be written to make the changes to the file, but also any other programs that access the files must be changed to reflect the new structure of the data storage files. This anomaly is known as program-data dependence.

Application program inflexibility Though we have discussed different problems with file-based data systems, they were a great improvement over the traditional file cabinet approach to keeping records. As these systems grew, the need for new or modified queries grew proportionally. (Queries, which will be discussed later in this course, are operations involving the retrieval or updating of data in the data files.) This need required the application programmer to create these queries within the programs designed to interact with the data. More often than not, these queries were fixed and inflexible, making it difficult or impossible for users to ask for unforeseen data. This made these programs inefficient and inadequate. Often, either limited or no documentation existed for the application programs, security was often overlooked, and data recovery was limited in cases of hardware or software failure. Also, access to the data was usually limited to one user at a time. In some organizations, another effect of the popularity of these systems was the propagation of these application programs. This fact made managing these applications and the data very difficult. Clearly, a different approach was needed to address the many problems with file-based data systems.

INSTRUCTOR NOTE: Refer to Instructor Note 1-1 for an example of the problems caused by data dependence.

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-5

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

The Evolution of Databases Databases emerged from the need for a more efficient method of storing and manipulating data. As previously discussed, although the file-based approach was a substantial improvement over manual filing systems, it was still inadequate.

In a database system, a single repository of logically related data replaces the files that once held the data in many different places. Instead of many files with a great deal of repeated data, the data is integrated with minimal replication. The data is normally contained in two-dimensional tables. This data structure will be fully discussed in a later lesson.

Importantly, a database also contains a description of the data. This description is referred to as the system catalog. Some databases use the term data dictionary (or metadata, which is data about data). Data dictionaries will be discussed in a later lesson.

The following sections will discuss how a database approach resolves the issues of a file-based data storage system.

Resolving repetition of data With the tabular structure that a database uses, it is possible to minimize the repetition of data. The database developer can use several database design practices that permit repeated data to exist only when necessary or desired. These methods will be discussed in detail in a later lesson.

Resolving separation of data A database gathers data held in separate files and integrates it into one central repository. This makes the data much easier to manage. For example, if duplicate data does exist, a database affords mechanisms to ensure that the data is simultaneously updated. Also, because the data is held in one central location, manipulating the data becomes a much simpler process. Instead of having to coordinate operations against multiple files across multiple locations, the application programmer need only access one device to manipulate the data.

Resolving incompatibility of files and data dependence A database is an independently defined entity. Application programs that are written to access the database need not be concerned with how the database is defined or how it holds the data. Because the data is stored in a separate mechanism, application programs also become completely independent entities, thus achieving program-data independence.

This separation of database systems and the programs that access them falls very much in line with other modern software development principles. In object-oriented programming, objects have an internal definition and an external definition. The users of the object see only the external definition and need not be concerned with the internal workings of the object or how it functions. Thus the internal definition of the object can change without affecting the external interfaces. Similarly, databases separate the structure of the data from the programs designed to access the data. Consequently, new data structures can be added to the database without the need to modify the application programs that access the data.

OBJECTIVE: 1.3.10: Data dictionary

system catalog Part of a database that describes the data in the database.

EVAL

UAT

ION

CO

PY

1-6 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Resolving application program inflexibility With the separation of data and application programs mentioned previously, many of the problems discussed earlier are addressed. The application programmer can create more flexible programs with much more flexible queries.

Databases allow a more centralized approach to data manipulation. Because data is held in a central repository, the number of applications written to access the data can be reduced. As the access programs become centralized, the following tasks become much easier:

• Maintaining the application programs

• Documenting the application programs

• Offering additional functionality within the application programs

• Providing security mechanisms

• Providing data recovery mechanisms

• Allowing multiple users to access the data at one time

As you can see, databases have effectively addressed most of the major problems with file-based data storage and retrieval systems.

Relational Databases and Database Management Systems (DBMSs) A relational database is a body of data organized as a set of formally defined tables. Data can be accessed or reassembled from the database in many different ways without having to reorganize the database tables. The tables can (and usually do) contain data that relates to data held in other tables within the database. This course will fully explore the concepts behind designing these databases and the tables within them, as well as the manipulation of the data.

As databases have evolved, so has the software that stores and manages the data. This software is referred to as a database management system (DBMS). A DBMS allows users to define, create, and maintain databases while providing controlled access to the database. Many DBMSs are available for use on many varying platforms. Though all DBMSs have individual features, most usually provide a well-defined set of features. Some of these features are as follows.

• As the data is held within a central repository, the DBMS can support a specific language (a query language) to facilitate the manipulation of the data. The actual language for relational DBMSs is Structured Query Language (SQL). SQL will be covered in detail in a later lesson. Database designers can define databases using Data Definition Language (DDL), a subset of SQL. DDL permits the database designer to specify the data types held in the database as well as constraints on the data.

• The DBMS allows users to retrieve, insert, update and delete data in the database using Data Manipulation Language (DML), a subset of SQL.

• The DBMS typically provides a security system, an integrity system for preserving the consistency of the data, a concurrency control system for shared access of the database, a recovery system for restoring the database to a previous state in case of hardware or software failure, and a data dictionary for describing the data in the database.

INSTRUCTOR NOTE: One of the major advantages of separation of data and application programs was the development of an independent language to interact with the database in a uniform manner. This language became known as Structured Query Language (SQL). SQL will be discussed further in this lesson, and in subsequent lessons in this course.

relational database A collection of data organized as a set of formally described tables.

OBJECTIVE: 1.1.2: DBMS types

database management system Software that supports the creation and management of databases.

Structured Query Language A language used to create professional, high-performance corporate databases.

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-7

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

• The DBMS provides a view mechanism, which allows the database administrator (DBA) to create views particular to each set of users of the database. A view is a subset of the data in the database. Views are useful when users do not need to see or access all the data in the database. Views will be discussed in a later lesson.

The previous list is general and is not intended to describe all DBMSs. Some DBMSs may provide more functionality; others may provide less. As an example, a DBMS for a desktop computer may not provide concurrency control, and may have limited security and integrity mechanisms. A DBMS intended for large, multiuser systems would definitely provide the functionality listed earlier and usually more. With the important role that the database plays in today's corporate and business communities, the DBMS must be completely reliable and provide availability of data even in the event of hardware or software failures.

Advantages and disadvantages of a DBMS As with other software programs, using a DBMS has advantages and disadvantages. Though the advantages outweigh the disadvantages, both will be discussed in the following sections.

Following are advantages offered by a DBMS.

• Management of data redundancy: As has been discussed, file-based systems tend to store duplicated data across multiple files. A DBMS integrates data into a central repository, thus eliminating unneeded repetition of data. It is important to remember, however, that the database does not completely eliminate data redundancy. In many cases, repetition of data is needed to improve performance, and, most important, redundant data is needed to model data relationships. A DBMS provides mechanisms for ensuring that updates to redundant data are properly synchronized.

• Consistency of data: This item is a result of the ability to control data redundancy. The risk of compromising the accuracy and consistency of the data is greatly reduced. If data appears in more than one location in the database, the DBMS can ensure that all instances of the data remain consistent with one another.

• Data sharing: In a file-based system, the files are usually owned and maintained by the particular department that uses them. Conversely, the database is owned by the entire organization. A DBMS allows authorized users to access the data more efficiently.

• Increased data integrity: Data integrity refers to the validity of the data in the database. A DBMS provides mechanisms for defining the type of data that can be held in a table or shared among tables. The DBMS is responsible for enforcing the constraints placed on the data in the database.

• Increased data security: A DBMS provides mechanisms to protect data from unauthorized use. Typically, the platform hosting the DBMS will have security measures in place, but most experts agree that you cannot have too much security. The DBA can define security measures, and the DBMS is responsible for enforcing those measures. These measures can be in the form of user names and passwords that identify authorized users of the database. The DBMS can further enforce restrictions on the type of operation a particular user can perform. And the DBMS can restrict access to particular areas of the database for certain users.

• Adherence to standards: The use of a DMBS frees application programmers from varying methods of data access and allows them to take advantage of using standard

database administrator The person who directs or performs all activities related to maintaining a database environment.

INSTRUCTOR NOTE: A DBMS enforces constraints on a database in many different ways. Data types are defined and other data types not allowed to be entered in a particular field. Also, a particular field may have a defined set of values with no other values allowed in the field. The DBMS also provides mechanisms to ensure that related data is manipulated synchronously. These concepts are discussed in detail later in this course.

EVAL

UAT

ION

CO

PY

1-8 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

data access methods. The use of SQL is an example of a standard afforded by a DBMS.

• Increased data access: As data is gathered into a central repository, data that may have been unavailable to certain users becomes available through the use of a DBMS. Also, many database management systems allow users to execute queries against the database without the use of a written application to access the database.

• Increased productivity: With a file-based system, the application programmer must provide low-level functionality within the data access programs. A DBMS provides many low-level data handling routines that would normally need to be written into an application. Application programmers are thus free to concentrate on the functionality needed by the users. Many database management systems also provide tools that aid in the development of database applications. These tools can increase the application programmer's productivity by helping in the rapid development of applications.

• Managed concurrency: As mentioned, file-based systems may not allow concurrent use of data resources. If the system does allow concurrent use of data, the simultaneous operations can result in the loss of data or the loss of data integrity. A DBMS provides mechanisms for handling concurrent data accesses. Concurrency will be discussed in a later lesson.

• Increased data backup and recovery: A DBMS provides mechanisms for both backing up a database and recovering a database in the event of hardware or software failure. In file-based systems, these responsibilities are placed on the user or application programmer.

Following are some disadvantages associated with a DBMS.

• Complexity: With all the services offered by a DBMS, it is no surprise that they are quite complex pieces of software. The database designer and the DBA must have a firm understanding of the functionality that a DBMS offers in order to fully realize its potential. On the other hand, if the complexities of the software are not understood, the DBMS can cause more problems than it solves.

• Size of the software: With all that a DBMS offers comes the price of disk space. Most sophisticated DBMSs are extremely large pieces of software, taking up many megabytes of disk space and requiring significant amounts of memory in order to run efficiently.

• Cost: Like any piece of software, there is the cost of ownership. Though the cost will vary from product to product, it is still a factor that must be considered when deciding on a DBMS. A DBMS may also necessitate the purchase of additional hardware, perhaps for both additional storage space and a machine to actually host the DBMS. Also, the cost of converting old data to the new DBMS format must be considered, along with the time and cost of training employees to use the new system.

• Increased impact in case of DBMS failure: As data becomes centralized, the vulnerability of the system also increases. If the database hosted by the DBMS becomes unavailable, organization-wide operations might possibly come to a stop.

In most cases, the benefits gained by the use of a DBMS far outweigh any drawbacks. However, when considering the use of a DBMS, you must weigh and consider all factors before committing to a particular product.

INSTRUCTOR NOTE: It should be noted that file-based programs written with specific functionality might perform slower within a DBMS. This is because the original program was written to perform one specific task. A DBMS is designed to provide general functionality and services for many different database applications. Depending on the DBMS's workload, some programs may run slower than with a file-based approach.

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-9

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Choosing the correct database type You may not always need a complex DBMS. Often, choosing a simple, file-based approach is sufficient for the task at hand. Also, several small-scale desktop products may meet the demands of a particular situation more effectively than a full-scale DBMS. A large part of managing data is deciding what tools will efficiently allow users to access and manipulate the data.

Following are a few questions that should be answered when deciding what type of database is appropriate for a particular situation.

• How much data is going to be involved in your data store? Less than a megabyte? More than a megabyte?

• How much will your data grow? How fast will it grow?

• Can the data with which you are dealing be represented in a tabular format?

• How often does the data need to be accessed?

• Do you have multiple sets of data that contain related data, and do you need to run complex queries or operations involving the various sets of data?

• Will more than one person ever need access to the data at one time?

• How fast does the access to the data need to be?

• How reliable does your data storage system need to be?

• Does your data storage system need to support transactions? (A transaction is a sequence of information exchange, such as a database update, that is treated as an entity for the purposes of completing an operation and for ensuring database integrity. This concept will be discussed in a later lesson.)

These items provide a skeletal list of questions that should be answered as a data storage system is being planned.

Choosing the correct type of data storage system is as important as how that system is built. Careful planning and analysis are needed before beginning any data storage project. Planning a data storage system will be discussed further in a later lesson.

Origins of Relational Databases Dr. E.F. Codd first proposed the relational data model in 1970. His paper, titled "A Relational Model of Data for Large Shared Data Banks," is considered a milestone in modern database evolution. Many different organizations played a part in this evolution, with three notable projects. The first was the IBM prototypical relational DBMS named System R. This DBMS was developed during the late 1970s, and was designed to demonstrate that the relational model could work. System R implemented the relational model's data structures and provided operations on those structures. The development of SQL as well as the production of several commercial relational DBMS products came out of this project. These products include DB2 and SQL/DS from IBM and Oracle from the Oracle Corporation.

The second noteworthy project was named the Interactive Graphics Retrieval System (INGRES). This project took place at the University of California at Berkeley at about the same time as the System R project. The development and research of the INGRES project had approximately the same goals as the System R project, and a prototypical relation

OBJECTIVE: 3.2.2: Appropriate database designs

INSTRUCTOR NOTE: Students interested in further investigation of Dr. E.F. Codd's "The Relational Model for Database Management: version 2" can find the paper at the following URL: http://portal.acm.org/toc.cfm?id=SERIES11430&type=series&coll=ACM&dl=ACM

EVAL

UAT

ION

CO

PY

1-10 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

DBMS was developed. An academic version of INGRES led to a commercial version from Relational Technology Inc. (now Computer Associates).

Finally, the IBM UK Scientific Center developed a project named the Peterlee Relational Test Vehicle in 1976. This project was more theoretical in nature than the two mentioned previously. Important information concerning query processing and database optimization emerged from this project.

Commercial products using the relational model appeared in the late 1970s and early 1980s. Today, several hundred different relational DBMSs exist for both mainframe and desktop systems. Also, some nonrelational DBMSs provide a relational user interface, even though the underlying architecture does not adhere to the relational model. Relational databases have proved to be the most popular type of database in use today, with sales of billions of dollars every year. Research into relational technology continues today, with the development of object-oriented relational databases leading the way.

Case Study How Simple Is Too Simple? Joe has a new job with Acme Widgets Inc. Sales have been steadily increasing and the company wants to respond to the high demand by enabling sales through the company Web site. Initially Joe is tasked with determining what type of database system would be required. The company currently stores all of its customer and order information in a spreadsheet. Joe begins by getting a solid description of the data requirements. These are as follows:

• The company wants to store data on customers and specific orders.

• The company wants to have the ability to track the shipping status of each order.

• The company wants to be able to generate various reports to show order statistics, demographics and sales trends.

After reviewing the requirements, Joe decides that a flat-based database would not provide sufficient flexibility to generate the types of reports for which the company managers have expressed a need. Also, because widget sales have been steadily increasing, Joe does not think a flat-based file could efficiently store the necessary amount of data or offer the report generation flexibility Acme requires.

Joe recommends that a relational database management system should be used to capture, store and manipulate the required data.

* * *

As a class, discuss Joe's recommendation to use a tool that may require a knowledgeable administrator as opposed to using a flat-based file with which several current employees would most likely be familiar. What would you recommend?

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-11

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson Summary

Application project When learning a new technology, investigating various resources can be very beneficial. Visit the following Web sites and explore some of the different database resources that are available.

• http://dir.yahoo.com/Computers_and_Internet/software/databases/

• www.wdvl.com/Authoring/DB/

• www.unifx.com/links.html

• www.w3schools.com/hosting/host_databases.asp

Skills review A database is a formally arranged set of persistent information stored by a computer program. Many different types of databases have been developed. Before the modern database, file-based data storage systems were probably the most prevalent. A file-based system is one in which a collection of application programs interacts with data held in various files, performing such services as the creation of reports.

Several problems can occur when using file-based systems. These problems include repetition of data, separation of data, incompatibility of files, data dependence, and inflexibility of the application programs that access the data.

Databases emerged out of the need for a more efficient method of storing and manipulating data. A database system is a single repository of logically related data that replaces the files that once held the data in many different locations. Modern database systems address and solve most of the problems present in file-based systems.

A relational database is a body of data organized as a set of formally defined tables. Most modern relational databases provide a DBMS. A DBMS provides services such as the support of a query language such as SQL. Database designers can use subsets of SQL such as DDL to define databases, and DML to manipulate data.

The main advantages a DBMS offers are management of data redundancy, concurrency control, consistency of data, data sharing, and increased data integrity, security, and access. Disadvantages of a DBMS include the cost of the software and possibly hardware, and the complexity of the software. A full-scale DBMS is not the solution for all data storage projects. Careful planning and analysis are needed before you commit to a particular database product.

Now that you have completed this lesson, you should be able to:

1.1.1: List database types (e.g., flat file, relational), and identify their uses and architectures.

1.1.2: Describe the types of database management system (DBMS), and explain the benefits and limitations of each DBMS type.

3.2.2: Analyze and select appropriate database designs, and identify the solution that addresses the application needs.

EVAL

UAT

ION

CO

PY

1-12 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson 1 Review 1. What is a database?

A database is a formally arranged collection of data organized to provide efficient

management and easy access of data.

2. Name two problems typically found in file-based database systems.

File-based databases typically contain the following problems: repetition of data,

separation of data, incompatibility of files, data dependence, and application program

inflexibility.

3. What is a system catalog?

A system catalog is a part of a database that describes the data in the database.

4. What is a database management system?

A DBMS is the software that supports the creation and management of databases.

5. What is the function of the database administrator?

The DBA directs or performs all activities related to maintaining a database

environment.

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-13

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson 1 Instructor Section This section is a supplement containing additional tasks for students to complete in conjunction with the lesson. It also contains additional instructor notes. The instructor may use all, some or none of these additional tools, as appropriate to the specific learning environment. These elements are:

• Additional Instructor Notes Detailed instructor notes that expand the tips and suggestions presented in the instructor margin notes throughout the lesson.

• Optional Labs Computer-based labs to be completed during class or as homework.

• Lesson Quiz Multiple-choice test to assess student knowledge of lesson material.

EVAL

UAT

ION

CO

PY

1-14 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Additional Instructor Notes The following section contains detailed instructor notes that expand the tips and suggestions presented in the instructor margin notes throughout the lesson.

Instructor Note 1-1

Location: File-Based Databases As mentioned in the Data Dependence section, the structure of a data storage file is often defined within the application code that manipulates the file. Suppose a file-based dataset contains a name field. Further suppose that the developer needs to increase the size of that field from 30 characters to 60 characters. A program would have to be written that changes the structure of the file containing the name field. The program would have to perform the following steps:

1. Access and open the data file to read the current information.

2. Create and open a new file with the new 60-character name field.

3. Read each record in the old file, change each name to the new format, then write each record to the new file.

4. Remove the old data file.

5. Rename the new file with the name of the old data file.

Any programs that access the old file would have to be modified to reflect the new structure of the data. This is a very inefficient approach. Not only can it be a time-consuming operation, but the possibility of errors being introduced into the programs is increased each time they are rewritten. Students can learn how a relational database addresses this situation later in the course.

Optional Lab 1-1: Using a flat-file database

In this lab, you will examine and use a file-based database. You will examine a DOS batch program written to access the file and extract a particular dataset from the database file. This lab will demonstrate the inflexibility of programs used to access flat-file databases, as well as the problems that might occur when trying to further manipulate a result set from such a database.

Note that you do not need to actually run the batch program to understand the objective of this lab. If you cannot or do not want to run the DOS batch program, follow the steps of the lab and study the screen captures provided. Following the steps of the lab will allow you to grasp the lab's objective.

1. Desktop: Use Notepad (or the editor of your choice) to open the employee.dat file located in the C:/CIW/DBDM/Lab Files/Lesson 1 folder and examine the following data: Jane Doe Personnel 714.555.1234 x100 John Doe Finance 714.555.1234 x200 Ed Wang Education 510.555.4321 x300 Julio Perez Sales 714.555.6677 x400 Sam Jones Personnel 818.555.3995 x101

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-15

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Pam Smith Finance 310.555.1210 x201 Bill Reid Education 714.555.6334 x301 Mai Lee Personnel 818.555.1434 x134 Juan Gonzalaez Finance 714.555.1256 x234 Lee Kim Education 510.555.4888 x334

2. Editor: Close the employee.dat file, then open the optionalLab1-1.bat file. Examine the following DOS code: @echo off set count=0 FOR /F "tokens=1,2,3,4,5 delims= " %%i in (employee.dat) do call :setnecho %%i %%l %%m echo %count% records found. goto :eof :setnecho set first=%1 set phone=%2 set area=%phone:~0,3% echo %first:~0,6% %area% %3 set /a count=%count% + 1

3. Editor: Do not be concerned with the syntax of the DOS code. For now, understand that this code is used to access the file-based database and to extract a dataset from the information held in that file. Close optionalLab1-1.bat.

4. Command prompt: Open a command prompt by selecting the Start menu. Select Run. Type cmd in the Run text box, then click the OK button. You should see a command prompt as shown in Figure OL1-1.

Figure OL1-1: Command prompt

5. Command prompt: Navigate to the directory that contains the optionalLab1-1.bat file. If you are unsure how to perform this task, ask your instructor for help.

6. Command prompt: Type the following command, then press ENTER to execute the optionalLab1-1.bat program: optionalLab1-1

7. Command prompt: Your screen should resemble Figure OL1-2.

EVAL

UAT

ION

CO

PY

1-16 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Figure OL1-2: Results of database manipulation

8. Command prompt: Close the command prompt by typing Exit, and pressing ENTER.

As mentioned in this lesson, the structure of a file-based database is usually embedded in the application code that accesses the file. That is exactly the case in this situation. Though this is a simple example, it illustrates the inflexibility of programming code that relies on the structure of the data held in a database.

Several items from this lab require discussion. First, examine one line of data from the file-based database: Jane Doe Personnel 714.555.1234 x100

In this case the data represents a first name, last name, department, phone number and extension number for an employee. However, note that the file-based database does not contain named columns, or fields, as would a relational database table. In a more complex database file, the lack of named columns could be somewhat confusing. Next, examine this line of code from the DOS program used to access the database: FOR /F "tokens=1,2,3,4,5 delims= " %%i in (employee.dat) do call :setnecho %%i %%l %%m

This line of code defines that each line in the employee.dat file contains five elements of data (also known as tokens) separated by a space delimiter. For each line of data, the program calls a subroutine (setnecho) with three arguments which represent elements 1, 4 and 5 (first name, phone number, and extension number, respectively) in each data row.

AS the program is executed, the values for elements 1, 4 and 5 of each line are manipulated (the area code portion of the phone number is extracted) and formatted (the elements are padded with spaces) and then printed on the screen.

Notice that the code to access this file-based database is closely tied to the structure of the data in the file.

Suppose that the dataset needed to be manipulated further. For example, the developer may want to display the information in alphabetical order or perhaps grouped by area codes. This would require further programming code in order to arrange the dataset according to the needs of the users.

EVAL

UAT

ION

CO

PY

Lesson 1: Introduction to Databases 1-17

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

To illustrate the simplicity that a relational database provides, examine a line of Structured Query Language (SQL) code that could be used to extract the same information from a relational database table: SELECT first_name, area_code, extension FROM Employees;

Compare this line of SQL code with the previous example of DOS code and you can easily see the advantage of using SQL to access the data. The programming code that contains this line of SQL does not need to concern itself with the structure of the data in the database. This is obviously a much more flexible approach to accessing the data. If the developer needs to arrange the result set in a particular manner, this is easily accomplished using SQL. Consider the following example: SELECT first_name, area_code, extension FROM Employees ORDER by area_code;

Simply adding the ORDER BY clause allows the result set to be arranged alphabetically. The result set could also be arranged by first_name or extension, or by all three fields if desired.

Do not be concerned with the syntax of the SQL statements at this point. SQL will be fully discussed later in this course. For now, realize the benefits provided by using a relational database and a standard language to access the data in the database.

EVAL

UAT

ION

CO

PY

1-18 Database Design Specialist

© 2011 Certification Partners, LLC — All Rights Reserved Version 1.0

Lesson 1 Quiz 1. Which of the following characterizes persistent information?

a. Data that remains accurate with the passage of time b. Data that remains intact after the program used to access it has ended c. Data that is used to query users and hosts d. Data that can be accessed only in its original state

2. Which of the following describes a file-based database?

a. They were created to address the need for more efficient data access. b. They generally use a centralized approach. c. They were the least common type of data storage system before computers were

used. d. They typically contain a single application program that interacts with data held

in several files.

3. Which of the following characterizes a relational database?

a. Data is organized as a loosely organized set of compared statements. b. Most relational databases do not provide a DBMS. c. New data added to the relational database requires the modification of

application programs used to access the data. d. Tables can (and usually do) contain data that relates to data held in other tables

within the database.

4. What is the name of the language used to facilitate the manipulation of data in a DBMS?

a. SQL b. DSN c. XML d. SSL

5. Which of the following is a disadvantage of using a DBMS?

a. Data is not protected from unauthorized users. b. DBMS complexity decreases productivity. c. System vulnerability increases with data centralization. d. Data consistency is reduced.

6. Which of the following is an advantage of using a DBMS?

a. DBMS software typically only uses minimal amounts of disk space. b. Converting old data to a DBMS format is generally free. c. A DBMS minimizes the need for standard data access methods. d. Data consistency is increased.

7. How many different relational DBMSs exist today for both mainframe and desktop systems?

a. Twenty-five b. Approximately 50 c. Several hundred d. More than 1,000