Download presentation
Presentation is loading. Please wait.
Published byVincent Stone Modified over 8 years ago
1
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases
2
2 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Objectives u Describe the differences and similarities between relational and object-oriented database management systems u Design a relational database schema based on an entity-relationship diagram u Design an object database based on a class diagram
3
3 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Objectives u Design a relational schema to implement a hybrid object-relational database u Describe the different architectural models for distributed databases
4
4 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Databases and DBMSs u Databases are integrated collections of stored data that are centrally managed and controlled l Described by a schema u DBMSs are system software components that manage and control access to a database
5
5 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Components of a DB and DBMS Figure 10-1
6
6 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd DBMS’s Important Capabilities u Simultaneous access by multiple users and applications u Access to data without application programs u Managing organizational data
7
7 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Database Models u Impacted by technology changes u Model Types l Hierarchical l Network l Relational l Object-oriented u Current systems generally use relational or object-oriented data models
8
8 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Relational Databases u The relational database management system organizes data into tables or relations u Tables: l Tuples: rows or records l Fields: columns or attributes u Tables have key field(s) which can be used to identify unique records u Keys relate tables to each other
9
9 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Partial Relational Database Table Figure 10-2
10
10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Designing Relational Databases 1.Create table for each entity type 2.Choose or invent primary key for each table 3.Add foreign keys to represent one-to- many relationships 4.Create new tables to represent many-to- many relationships
11
11 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Designing Relational Databases (con’t.) 5.Define referential integrity constraints 6.Evaluate schema quality and make necessary improvements 7.Choose appropriate data types and value restrictions (if necessary) for each field
12
12 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd RMO Entity Relationship Diagram Figure 10-5
13
13 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Enforcing Referential Integrity u Consistent relational database state u Every foreign key also exists as a primary key value u DBMS enforces referential integrity automatically once schema designer identifies primary and foreign keys
14
14 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Automatic Enforcement for Referential Integrity u When rows containing foreign keys are created, DBMS ensures that the value also exists as a primary key in related table u When row is deleted, DBMS ensures no foreign key in related tables have the same value as primary key of deleted row u When primary key value is changed, DBMS ensures no foreign key values in related tables contain the same value
15
15 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Evaluating Schema Quality u High quality features l Uniqueness of table rows and primary keys l Ease of implementing future data model changes (flexibility and maintainability) l Lack of redundant data u Design is judgment-based
16
16 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Database Normalization u Ensure database quality by minimizing data redundancy u Normal forms l 1NF - no repeating fields or groups of fields l Functional dependency - one-to-one relationship between the values of two fields l 2NF - in 1NF and if each non-key element is functionally dependent on entire primary key l 3NF - in 2NF and if no non-key element is functionally dependent on any other non-key element
17
17 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Decomposition of 1NF Table into 2NF Tables Figure 10-12
18
18 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Conversion of 2NF Table into 3NF Tables Figure 10-13
19
19 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Object-Oriented Databases u Direct extension of the OO design and programming paradigm u ODBMS stores data as objects or classes u Object definition language (ODL) l Standard language for describing structure and content of an object database
20
20 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Designing Object Databases 1.Determine which classes require persistent storage 2.Define persistent classes 3.Represent relationships among persistent classes 4.Choose appropriate data types and value restrictions (if necessary) for each field.
21
21 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Representing Classes u Transient l Exist only during lifetime of program or process l Examples: view window, pop-up menu u Persistent l Not destroyed when program or process ceases execution l Exist independently of program l Examples: customer information, employee information
22
22 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Representing Relationships u Object identifiers l Used to identify objects uniquely l Physical storage address or reference l Relate objects of one class to another u ODBMS uses attributes containing object identifiers to find objects that are related to other objects
23
23 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Representing Relationships (con’t.) u Keyword relationship can be used to declare relationships between classes u Advantages include: l ODBMS assumes responsibility for determining connection l ODBMS assumes responsibility for maintaining referential integrity u Type of relationships l 1:1, 1:M, M:M l Association class used with M:M
24
24 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd 1:1 Relationship Represented with Attributes* Containing Object Identifiers Figure 10-16 *attributes shown in color
25
25 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd 1:M Relationship Between Customer and Order Classes Figure 10-17
26
26 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd 1:M with Attributes Containing Object Identifiers Figure 10-18
27
27 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd M:M Relationship between Employee and Project Classes Figure 10-19
28
28 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd M:M Relationship Represented with two 1:M Relationships Figure 10-20
29
29 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Generalization Hierarchy within the RMO Class Diagram Figure 10-21
30
30 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Hybrid Object-Relational Database Design u Relational database management system used to store object attributes and relationships u Two design tasks l Developing complete relational schema l Developing equivalent set of classes u Problems l Programmer defined method storage and execution l Relationships are restricted l ERDs cannot represent methods
31
31 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Relationships and Inheritance in Hybrid Design u Relationships must be represented with foreign keys u Inheritance l Combine all tables into a single table containing a superset of all class attributes but excluding all invented fields from child classes l Use separate tables to represent child classes and substitute the primary key of the parent for the invented keys of the child
32
32 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Data Types u Storage format and allowable content of a program variable u Primitive data types l Pointer, Boolean, integer, etc. u Complex data types l Dates, times, audio streams, video images l User-Defined data types
33
33 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Object DBMS Data Types u Comparable to RDBMS data types u Schema designer can create new data types and associated constraints u Classes are complex user-defined data types that contain methods to manipulate data
34
34 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Distributed Databases u Rare for all organizational data to be stored in one location in a single database u Different information systems in an organization are developed at different times u Parts of an organization’s data may be owned and controlled by different units u System performance is increased when data is near primary applications
35
35 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Single Database Server Architecture Figure 10-26
36
36 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Replicated Database Server Architecture Figure 10-27
37
37 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Partitioning Database Schema into Client Access Subsets Figure 10-28
38
38 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Partitioned Database Server Architecture Figure 10-29
39
39 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Federated Database Server Architecture Figure 10-30
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.