Jerry Post Copyright © 2013 DATABASE Database Management Systems Chapter 2 Database Design 1.

Slides:



Advertisements
Similar presentations
All Powder Board and Ski
Advertisements

MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Physical Database Design and Performance Dr. Mohamed Osman Ali Hegazi1.
Database Design & Mapping
Jerry Post McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Database Management Systems Chapter 2 Database Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 2 Database System Design (part II)
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
DATABASE APPLICATION DEVELOPMENT SAK 3408
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Access Lecture 1 Database Overview and Creating Tables Create an Employee Table.
Object Oriented Data Base. Traditional Data Models : Hierarchical, Network (since mid- 60’s), Relational (since 1970 and commercially since 1982) Object.
APPENDIX C DESIGNING DATABASES
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
Tables. Any database must contain one or more tables, because that’s where the data is stored. For any table there are two views provided: Datasheet view.
Chapter 2 Database System Design Based on G. Post, DBMS: Designing & Building Business Applications University of Manitoba Asper School of Business 3500.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
ระบบฐานข้อมูลขั้นสูง (Advanced Database Systems) Lecturer AJ. Suwan Janin Phone:
1 Copyright © 2010 Jerry Post. All rights reserved. Database System Design IS240 – DBMS Lecture #3 – M. E. Kabay, PhD, CISSP-ISSMP Assoc. Prof.
DATABASE DESIGN LECTURE FOUR. Why Design a Database? Goal:  To produce an information system that adds value for the user  Reduce costs  Increase sales/revenue.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
MIS 327 Database Management system 1 MIS 327: DBMS Dr. Monther Tarawneh Dr. Monther Tarawneh Week 6: Database Design: Example Rolling Thunder.
CITY UNIVERSITY / Vysoká Škola Manažmentu.:IS Information Systems :. © Martina Cesalova, 2005 MS ACCESS 1 Start Microsoft Access – New - Blank Database.
Chapter 14 Information System Development
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
MIS 301 Information Systems in Organizations Dave Salisbury ( )
University of Manitoba Asper School of Business 3500 DBMS Bob Travica
1 All Powder Board and Ski SQL Server Workbook Chapter 2: Database Design Jerry Post Copyright © 2004.
Common Field Types Primary Key Descriptive Fields Foreign Key.
G045 Lecture 09 ERD Diagrams (Entity Relationship Diagrams) Mr C Johnston ICT Teacher
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
1.NET Web Forms Business Forms © 2002 by Jerry Post.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
© 2007 by Prentice Hall1-1 Chapter 1 Introduction to Relational Database Systems and Oracle 10g Introduction to Oracle 10g James Perry and Gerald Post.
SYSTEMSDESIGNANALYSIS 1 Chapter 22 Object-Oriented Design Jerry Post Copyright © 1997.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
All Powder Board and Ski Microsoft Access Workbook Chapter 2: Database Design Jerry Post Copyright © 2003.
School of Computer & Communication of LNPU 辽宁石油化工大学计算机与通信工程学院 刘旸 1 Chapter 2 Database Design 第二章 数据库设计 数据库管理系统 Database Management Systems.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/Programs/Microsoft Office/Microsoft Office.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
All Powder Board and Ski Oracle 9i Workbook Chapter 3: Database Tables Jerry Post Copyright © 2003.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Getting Started in Access 1 Using an existing Database Database Window Table Design View Parts of a Table Views in Access Navigating in Access Entering.
Creating E/R Diagrams with SQL Server Management Studio, Writing SQL Queries D0ncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer.
Course Contents Overview: Database basics Lesson 1: Benefits of using a database Lesson 2: Table that data Lesson 3: Analyzing, viewing, and reporting.
Database Planning Database Design Normalization.
DATABASE MIS 327 Advanced Database 1. DATABASE 2 Objectives  Why are models important in designing systems?  How do you begin a database project? 
Jerry Post Copyright © Database Management Systems Chapter 2 Database Design.
Chapter 1 Introduction.
Databases Chapter 9 Asfia Rahman.
Module 2: Creating Data Types and Tables
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Chapter 2: Database Design All Powder Board and Ski
Data Definition and Data Types
All Powder Board and Ski
Database System Design
Supplement: Using the DBDesign System
Presentation transcript:

Jerry Post Copyright © 2013 DATABASE Database Management Systems Chapter 2 Database Design 1

Objectives  What is database design and why is it important?  Why are models important in designing systems?  How do you begin a database project?  How do you know what data to put in the database?  What is a class diagram (or entity-relationship diagram)?  Is there an easier way to get started with database design?  How are some common business associations handled in class diagrams?  Are more complex diagrams different?  What are the different data types?  What are events, and how are they described in a database design?  How are teams organized on large projects?  How does UML split a big project into packages?  What is an application?  What process is followed when starting a project? 2

Database System Design 3 User views of data. Conceptual data model. Implementation (relational) data model. Physical data storage. Class diagram that shows business entities, relationships, and rules. List of nicely-behaved tables. Use data normalization to derive the list. Indexes and storage methods to improve performance. Patient(PatientID, LastName, FirstName, DateOfBirth,...) Visit(VisitID, PatientID, VisitDate, InsuranceCompany,...) PatientDiagnoses(VisitID, ICD9Diagnosis, Comments) VisitProcedures(VisitID, ICD9Procedure, EmployeeID, AmountCharged) ICD9DiagnosisCodes(ICD9Diagnosis, ShortDescription) ICD9ProcedureCodes(ICD9Procedure, ShortDescription) Employee(EmployeeID, LastName, FirstName, EmployeeCategory,...) EmployeeCategory(EmployeeCategory)

The Need for Design  Goal: To produce an information system that adds value for the user  Reduce costs  Increase sales/revenue  Provide competitive advantage  Objective: To understand the system  To improve it  To communicate with users and IT staff  Methodology: Build models of the system 4

Designing Systems  Designs are a model of existing & proposed systems  They provide a picture or representation of reality  They are a simplification  Someone should be able to read your design (model) and describe the features of the actual system.  You build models by talking with the users  Identify processes  Identify objects  Determine current problems and future needs  Collect user documents (views)  Break complex systems into pieces and levels 5

Design Stages  Initiation  Scope  Feasibility  Cost & Time estimates  Requirements Analysis  User Views & Needs Forms Reports  Processes & Events  Objects & Attributes  Conceptual Design  Models Data flow diagram Entity Relationships Objects  User feedback  Physical Design  Table definitions  Application development Queries Forms Reports Application integration  Data storage  Security  Procedures  Implementation  Training  Purchases  Data conversion  Installation  Evaluation & Review 6

Initial Steps of Design 7 1.Identify the exact goals of the system. 2.Talk with the users to identify the basic forms and reports. 3.Identify the data items to be stored. 4.Design the classes (tables) and relationships. 5.Identify any business constraints. 6.Verify the design matches the business rules.

Entities/Classes 8 Customer CustomerID LastName FirstName Phone Address City State ZIP Code Name Properties Add Customer Delete Customer Methods (optional for database)

Tables and Relationships 9 Customer CustomerID LastName FirstName Phone Address City State ZIP Code Sales SaleID SaleDate CustomerID 1 *

Business Rules 10 Tables and their relationships represent business rules. Different businesses can have different assumptions and different rules which result in different database designs. Many of these rules show up in the form of one-to-many or many-to- many associations. Can a Customer place one Order or many orders? Does an Order come from one Customer or many Customers? In most businesses, a Customer can place many Orders and each Order comes from exactly one Customer.

Definitions 11  Relational database: A collection of tables.  Table: A collection of columns (attributes) describing an entity. Individual objects are stored as rows of data in the table.  Property (attribute): a characteristic or descriptor of a class or entity.  Every table has a primary key.  The smallest set of columns that uniquely identifies any row  Primary keys can span more than one column (concatenated keys)  We often create a primary key to insure uniqueness (e.g., CustomerID, Product#,...) called a surrogate key. EmployeeIDTaxpayerIDLastNameFirstNameHomePhoneAddress CartomAbdul(603) South Street VenetiaanRoland(804) Paramaribo Lane JohnsonJohn(703) Main Street StenheimSusan(410) W. Maple Employee Properties Rows/Objects Class: Employee Primary key

Unified Modeling Language (UML) 12 A relatively new method to design systems. Contains several types of diagrams: The class diagram is the most important for database design.

Definitions 13 Entity:Something in the real world that we wish to describe or track. Class: Description of an entity, that includes its attributes (properties) and behavior (methods). Object:One instance of a class with specific data. Property:A characteristic or descriptor of a class or entity. Method:A function that is performed by the class. Association:A relationship between two or more classes. Entity:Customer, Merchandise, Sales Class: Customer, Merchandise, Sale Object:Joe Jones, Premium Cat Food, Sale #32 Property:LastName, Description, SaleDate Method:AddCustomer, UpdateInventory, ComputeTotal Association:Each Sale can have only one Customer. Pet Store Examples

Associations  General  One-to-one(1:1)  One-to-many(1:M)  Many-to-many(M:N)  Relationships represent business rules  Sometimes common-sense  Sometimes unique to an organization  Users often know current relationships, rarely future  Objects related to objects  An employee can work in only one department  Many departments can work on many different products  Objects related to properties  An employee can have only one name  Many employees can have the same last name 14 1* AnimalBreed ** performs  TasksEmp 1* places  SaleCust. 1* Purch. Order Supplier  sent to

Class Diagram  Class/Entity(box)  Association/Relationship  Lines  Minimum 0: optional 1: required  Maximum Arrows 1, M 15 Customer Order Item 1 … 1 0 … * 1 … *..

Sample Association Rules (Multiplicity)  An order must have exactly 1 customer,  1 … 1Minimum of 1  1 … 1Maximum of 1  And at least one item.  1 … *Minimum of 1  1 … *Maximum many  An item can show up on no orders or many orders.  0 … *Optional (0)  0 … *Maximum many 16 Customer Sale Item 1 … 1 0 … * 1 … *

Creating a Class Diagram Identify the primary classes and data elements. 2. Create the easy classes. 3. Create generated keys if necessary. 4. Add tables to split many-to-many relationships. 5. Check primary keys. 6. Verify relationships CustomerIDOrderID Each customer can place many orders (so key OrderID) Each order comes from one customer (do not key CustomerID) *OrderID CustomerID

Sample Database for Sales Sale IDDate Customer First Name Last Name Address City, State ZIPCode ItemIDDescriptionList PriceQuantityQOHValue Total 18

Quick Start 19 Initial Business Objects: Customers Items Sales Each seems to be a base object that can stand alone. Each can be given a generated key by the database.

Initial Tables 20

Relationship for Customers and Sales 21 CustomerIDSaleID Write down both primary keys. Answer two questions (left to right and right to left): Can a Customer place one Sale or many?Many => key SaleID Can a Sale come from one Customer or many?One => no key for CID CustomerID*SaleID So need a table where SaleID is the only key:Sales Add CustomerID to that table but do NOT make it a key.

Sales and Customers 22 Each Sale has one Customer Each Customer can place many Sales

Sales and Items Relationship 23 SaleIDItemID Each Sale can have many Items (key ItemID). Each Item can be sold many times (key SaleID). Need a table with both SaleID and ItemID as keys: *SaleID *ItemID Table does not exist, so create it: SaleItems

New SalesItem Table 24

Using Generated Keys 25

N-ary Associations  Associations can connect more than two classes.  Associations can become classes.  Events  Many-to-many  Need to keep data  Example has two many-to-many relationships.  We know which components go into each product.  We know which employees worked on a product.  We need to expand the relationships to show which employees installed which components into each product.  Each assembly entry lists one employee, one component, and one product.  By appearing on many assembly rows, the many-to-many relationships can still exist. 26 Employee Component Product * * **

N-ary Association Example 27 Employee Name... Component CompID Type Name Product ProductID Type Name * ** Assembly EmployeeID CompID ProductID Multiplicity is defined as the number of items that could appear if the other N-1 objects are fixed. Almost always “many.” 1 1 1

Association Details: Aggregation 28 Sale SaleDate Employee Item Description Cost * * contains  Aggregation: the Sale consists of a set of Items being sold.

Association Details: Composition 29 Bicycle Size Model Type … Wheels Rims Spokes … 12 built from  Composition: aggregation where the components become the new object. Crank ItemID Weight Stem ItemID Weight Size Bicycle Size Model Type … Wheels Crank Stem Two ways to display composition.

Association Details: Generalization 30 Animal DateBorn Name Gender Color ListPrice Mammal LitterSize TailLength Claws Fish FreshWater ScaleCondition Spider Venomous Habitat {disjoint}

Inheritance  Class Definition--encapsulation  Class Name  Properties  Methods  Inheritance Relationships  Generic classes  Focus on differences  Polymorphism  Most existing DBMS do not handle inheritance 31 Accounts AccountID CustomerID DateOpened CurrentBalance OpenAccount CloseAccount Class name Properties Methods Savings Accounts InterestRate PayInterest Checking Accounts MinimumBalance Overdrafts BillOverdraftFees CloseAccount Inheritance Polymorphism

Multiple Parents 32 Vehicle Human Powered MotorizedOn-RoadOff-Road CarBicycle or

Association Details: Reflexive Relationship 33 Employee manager 0…1 worker *  manages A reflexive relationship is an association from one class back to itself. In this example, an employee can also be a manager of other employees.

Defining Packages for High-Level Views 34 Purchase Merchandise Adopt Animals Sell Merchandise EmployeeSupplierCustomer

PetStore Overview Class Diagram 35 Animal CustomerSupplier Merchandise Adoption Group Merchandise Purchase SaleEmployee * 1 * 1 1 * * 1 * * * * *1*1

Pet Store Class Diagram: Access 36

Data Types (Domain)  Common data types  Text Fixed length1 to 64 K bytes Variable length1 to 2 G bytes  Memo/Note  Numeric Byte1 byte0 to 255 Boolean2 bytesTrue or False Integer2 bytes-32,768 to 32,767 (no decimal points) Long4 bytes-2,147,483,648 to 2,147,483,647 (no decimal points) Floating4 bytes E-45 to E38 Double8 bytes E-324 to E308 Currency8 bytes-922,377,203,685, to 922,377,203,685,  Date/Time8 bytesJan 1, 100 to Dec 31, 9999  Objects/Raw binary Any type of data supported by the machine Pictures, sound, video... 37

Data Types GenericAccessSQL ServerOracle Text fixed variable Unicode memo XML NA Short Text Long Text NA char varchar nchar, nvarchar nvarchar(max) Xml CHAR VARCHAR2 NVARCHAR2 LONG XMLType Number Byte (8 bits) Integer (16 bits) Long (32 bits) (64 bits) Fixed precision Float Double Currency Yes/No Byte Integer Long NA Decimal Float Double Currency Yes/No tinyint smallint int bigint decimal(p,s) real float money bit INTEGER NUMBER(38,0) NUMBER(p,s) NUMBER, FLOAT NUMBER NUMBER(38,4) INTEGER Date/Time Interval Date/Time NA datetime smalldatetime interval year … DATE INTERVAL YEAR … ImageOLE Objectvarbinary(max)LONG RAW, BLOB AutoNumber Identity rowguidcol SEQUENCES ROWID 38

Data Type Sizes Data TypesSize AccessSQL ServerOracle Text (characters) fixed variable memo XML K 8 K, 4 K 2 G, 1 G 2G 2 K 4 K 2 G Numeric Byte (8 bits) Integer (16 bits) Long (32 bits) (64 bits) Fixed precision Float Double Currency Yes/No 255 +/ /- 2 B NA p: /- 1 E 38 +/- 1 E 308 +/ trillion 0/ / /- 2B 18 digits +/- 1 E 38, p: 1 to 38 +/- 1 E 38 +/- 1 E 308 +/ trillion (8 bytes) 0/1 38 digits p: 38 digits s: -84 to 127; p: 1 to digits Date/Time1/1/100 – 12/31/9999 (1 sec)1/1/1753 – 12/31/9999 (3 ms) 1/1/1900 – 6/6/2079 (1 min) 8 bytes 1/1/-4712, 1/31/9999 (sec) ImageOLE Object2 GB2 GB, 4 GB AutoNumberLong (2 B)2 B or 18 digits with bigintColumn: 38 digit maximum 39

Computed Attributes 40 Denote computed values with a preceding slash (/). Employee Name DateOfBirth /Age Phone … {Age = Today - DateOfBirth}

Event Examples  Business Event  Item is sold.  Decrease Inventory count.  Data Event  Inventory drops below preset level.  Order more inventory.  User Event  User clicks on icon.  Send purchase order to supplier. 41 ON (QuantityOnHand < 100) THEN Notify Purchasing Manager Trigger

Event Triggers 42 Order … ShipOrder … Inventory … Subtract Analyze … 1. Subtract(Prod, Qty sold) 1.1 Analyze (Product) Purchase … Reorder … Reorder (Product, quantity) low Inventory … Subtract Analyze … Business Process: Ship Product Trigger: Inventory Change Executes function/trigger in Inventory object. Object: Inventory Property: Current Inventory. Function: Update Inventory. Trigger: On Update, call Analyze function. Process: Analyze Inventory Function: Determine need to reorder. Trigger: Generate new order.

Design Importance: Large Projects  Design is harder on large projects.  Communication with multiple users.  Communication between IT workers.  Need to divide project into pieces for teams.  Finding data/components.  Staff turnover--retraining.  Need to monitor design process.  Scheduling.  Evaluation.  Build systems that can be modified later.  Documentation.  Communication/underlying assumptions and model. 43

Large Projects  Project Teams  Divide the work  Fit pieces together  Evaluate progress  Standards  Design  Templates  Actions  Events  Objects Naming convention Properties  Project planning software  Schedules  Gantt charts  CASE tools  Groupware tools  Track changes  Document work  Track revisions 44

CASE Tools  Computer-Aided Software Engineering  Diagrams (linked)  Data Dictionary  Teamwork  Prototyping Forms Reports Sample data  Code generation  Reverse Engineering  Examples  Rational Rose  Sterling COOL: Dat COOL: Jex (UML)  Oracle  IBM 45

Rolling Thunder: Top-Level 46 SalesAssembly PurchasingLocation Bicycle Employee

Rolling Thunder: Sales 47 Customer CustomerID Phone FirstName LastName Address ZipCode CityID BalanceDue Customer Transaction CustomerID TransactionDate EmployeeID Amount Description Reference Retail Store StoreID StoreName Phone ContactFirstName ContactLastName Address ZipCode CityID Bicycle::Bicycle BicycleID … CustomerID StoreID … 1…1 0…* 1…1 0…* 0…1

Rolling Thunder: Bicycle 48 Bicycle SerialNumber CustomerID ModelType PaintID FrameSize OrderDate StartDate ShipDate ShipEmployee FrameAssembler Painter Construction WaterBottleBrazeOn CustomName LetterStyleID StoreID EmployeeID TopTube ChainStay … 1…1 ModelType Description Paint PaintID ColorName ColorStyle ColorList DateIntroduced DateDiscontinued LetterStyle LetterStyleID Description BicycleTubeUsed SerialNumber TubeID Quantity BikeParts SerialNumber ComponentID SubstituteID Location Quantity DateInstalled EmployeeID 1…* 0…* 1…1 0…* 1…1

Rolling Thunder: Assembly 49 Bicycle::BikeParts SerialNumber ComponentID... 1…1 Component ComponentID ManufacturerID ProductNumber Road Category Length Height Width Description ListPrice EstimatedCost QuantityOnHand ComponentName AssemblyOrder Description GroupComponents GroupID ComponentID Groupo GroupID GroupName BikeType Bicycle:: BicycleTubeUsed SerialNumber TubeID Quantity TubeMaterial TubeID Material Description Diameter … 0…* 1…1 0…* 1…1 0…* 1…1 0…* 1…1

Rolling Thunder: Purchasing 50 PurchaseOrder PurchaseID EmployeeID ManufacturerID TotalList ShippingCost Discount OrderDate ReceiveDate AmountDue 1…1 PurchaseItem PurchaseID ComponentID PricePaid Quantity QuantityReceived Manufacturer ManufacturerID ManufacturerName ContactName Phone Address ZipCode CityID BalanceDue ManufacturerTrans ManufacturerID TransactionDate Reference EmployeeID Amount Description Assembly:: Component ComponentID ManufacturerID ProductNumber 0…* 1…1 0…* 1…1 1…* 0…*

Rolling Thunder: Location 51 City CityID ZipCode City State AreaCode Population1990 Population1980 Country Latitude Longitude Sales:: Customer CustomerID … CityID Sales:: RetailStore StoreID … CityID Employee:: Employee EmployeeID … CityID Purchasing:: Manufacturer ManufacturerID … CityID 0…* 1…1 0…* StateTaxRate State TaxRate 1…1 0…1

Rolling Thunder: Employee 52 Employee EmployeeID TaxpayerID LastName FirstName HomePhone Address ZipCode CityID DateHired DateReleased CurrentManager SalaryGrade Salary Title WorkArea Bicycle:: Bicycle SerialNumber … EmployeeID ShipEmployee FrameAssembler Painter Bicycle:: BikeParts SerialNumber ComponentID … EmployeeID Purchasing:: PurchaseOrder PurchaseID … EmployeeID 1…1 0…* 1…1 0…* manager manages  worker 0…* 0…1

Rolling Thunder: Combined 53

Application Design  Simple form based on one table (Animal).  But also need lookup tables for Category and Breed. 54

Corner Med: Patient Visit Form 55

Corner Med: Basic Tables 56

Appendix: DB Design System   Students and instructors need only an Internet connection and a Java- enabled Web browser.  Instructor can sign up free by sending to:  Instructors set up the class and select assignments.  Students create accounts and work on the assignments.  The system provides immediate feedback in the form of comments and questions for each proposed table. 57

Appendix: Typical Customer Order 58

Appendix: DB Design Screen 59 Menu Drawing area Right-click to add tables Title box Drag to move Double-click to set title Feedback window (Double-click errors for details.) Scroll bars to display more of the drawing area Column list Status line Drag borders to resize

Appendix: Adding a Table and a Key  Right click in the main drawing window and select the option to Add table.  Right click the gray bar at the top of the table, select the Rename table option and enter “Customer”  Drag the Generate Key item onto the new Customer table.  Right click on the new column name, select the Rename option and enter “CustomerID”

Appendix: Two Tables  The Customer table has a generated key of CustomerID  Each column in the table represents data collected for each customer.  Each column depends completely on the primary key.  Each Order is identified by a unique OrderID generated by the database system.  The CustomerID column is used because the customer number can be used to look up the corresponding data in the Customer table. 61

Appendix: Relationships—Linking Tables  Drag the CustomerID column from the Customer table and drop it on the CustomerID column in the Orders table.  For the Min value in Customer, select One instead of Optional.  Click the OK button to accept the relationship definition. 62

Appendix: Saving and Opening Solutions 63 Resize Click handle to expand Solutions

Appendix: Creating Problems 64

Appendix: Detecting Problems (Grading) 65

Appendix: Testing a Change  Attempted fix  Make the relationship many-to-many  Make OrderID a key  But, the score went down!!! 66

Appendix: A Solution  The intermediate table OrderItem converts the many-to-many relationship into two one-to-many relationships.  Both OrderID and ItemID are keys, indicating that each order can have many items, and each item can be sold on many orders. 67

Appendix: Data Types 68 Right click the column names and set the data type.

Appendix: Generating Tables 69