Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Designing the Files and Databases. SAD/CHAPTER 102 Learning Objectives Discuss the conversion from a logical data model to a physical database.

Similar presentations


Presentation on theme: "Chapter 10 Designing the Files and Databases. SAD/CHAPTER 102 Learning Objectives Discuss the conversion from a logical data model to a physical database."— Presentation transcript:

1 Chapter 10 Designing the Files and Databases

2 SAD/CHAPTER 102 Learning Objectives Discuss the conversion from a logical data model to a physical database schema Understand the issues related to the physical design of fields, records, and files Identify the common file types and their applications

3 SAD/CHAPTER 103 Learning Objectives Understand the concepts of data integrity and referential integrity, and the various methods available as controls Identify the basic characteristics of the four common database architectures

4 SAD/CHAPTER 104 File and Database Design Goals The accurate translation of the logical relations into a technical specification Specifying the storage requirements and technologies for all data to be contained in the system

5 SAD/CHAPTER 105 Designing and Specifying Fields Data Attribute The smallest unit specified in the logical model Field The smallest unit specified in the physical model

6 SAD/CHAPTER 106 Field Types Primary Key Foreign Key Non-key

7 SAD/CHAPTER 107 Figure 10-1. Common Field Types Primary Key Descriptive Fields Foreign Key

8 SAD/CHAPTER 108 Data Types A detailed specification of the fields Primitive Data Type User-Defined Data Type

9 SAD/CHAPTER 109 Table 10-1. Common Data Type Definitions

10 SAD/CHAPTER 1010 Field Representation The process of determining how each field must be recorded in the data dictionary Examples: Ownership of the data element Coding method for data values Procedures for handling missing data values

11 SAD/CHAPTER 1011 Table 10-2. Common Field-Level Data Specifications

12 SAD/CHAPTER 1012 Calculated Field Values Compute-on-demand The calculated field is represented in the data dictionary but not stored in the file Recalculate-on-demand The field actually contains a value, but it is not recomputed unless there is a change in the values used to calculate it

13 SAD/CHAPTER 1013 Data Integrity Key Integrity Domain Integrity Referential Integrity

14 SAD/CHAPTER 1014 Key Integrity Ensure every file has a unique primary key Prevent any two records from having the same primary key value Primary key field must never be allowed to have a null value

15 SAD/CHAPTER 1015 Domain Integrity Ensure no data element value in a file or database is outside its range Any control imposed on a field will always be imposed on data entered or stored in that field, no matter what the circumstances

16 SAD/CHAPTER 1016 Table 10-3. Common Domain Controls

17 SAD/CHAPTER 1017 Figure 10-2. Example of Referential Integrity Between Files CUSTOMER (Customer ID, LastName, FirstName, Address, City, State, Zipcode) ORDER (Order ID, Customer ID, OrderDate)

18 SAD/CHAPTER 1018 Referential Integrity Exists when the foreign key value in one file has no matching primary key value in another related file Deletion rules (Table 10-4)

19 SAD/CHAPTER 1019 Table 10-4. Example of Referential Integrity Deletion Rules

20 SAD/CHAPTER 1020 Figure 10-3. Examples of Proper and Improper Field Sequencing IMPROPER PROPER

21 SAD/CHAPTER 1021 Record Length Fixed-length record All records have exactly the same number of bytes Variable-length record Each record contains a variable number of bytes

22 SAD/CHAPTER 1022 Figure 10-4. Fixed Length Record With Provision For Multiple Vendors Potentially Wasted Storage Space

23 SAD/CHAPTER 1023 Figure 10-5. Variable Length Record With Provision For Multiple Vendors Indicator for number of Vendor Fields

24 SAD/CHAPTER 1024 Paging and Blocking Page The actual amount of data read or written into memory Page size The total amount of memory allocated Blocking factor The number of records stored or retrieved for a given query

25 SAD/CHAPTER 1025 Figure 10-6. Example of Data Stored With and Without Blocking Record 1 Sector Without Blocking Unused Storage Space Record 5 Record 4 Record 3 Record 2 Record 1 512 bytes Sector With Blocking

26 SAD/CHAPTER 1026 Figure 10-7. Record Spanning Approach Sector 1 Unused Storage Space 512 bytes Sector 2 Record 5 Record 4 Record 3 Record 2 Record 1 Record 6 Part 1 Record 10 Record 9 Record 8 Record 7 Record 6 Part 2 Record 11 Part 1

27 SAD/CHAPTER 1027 Design and Specifying Files Physical file A grouping of all occurrences of a given record structure Often referred to as a table

28 SAD/CHAPTER 1028 Table 10-5. Common File Types and Uses

29 SAD/CHAPTER 1029 File Access methods Sequential File Access A record is accessed by scanning the file from the beginning until the desired record is found Direct or Random Access The address of the block containing the record is determined and then that block is retrieved

30 SAD/CHAPTER 1030 File Organization Sequential file Files are organized in ascending order according to the primary key A lookup table is often organized using this method Figure 10-8

31 SAD/CHAPTER 1031 File Organization Index file An index is created that allows the database application to locate a record The record can be stored in either sequential or random manner Figure 10-9

32 SAD/CHAPTER 1032 File Organization Direct file Allows a record to be retrieved using a single disk access operation Maximizing retrieval speed is the primary objective Figure 10-10

33 SAD/CHAPTER 1033 Figure 10-8. Sequential File Organization Method Physical Record Position in File Record Primary Key

34 SAD/CHAPTER 1034 Figure 10-9. Example of Record Lookup Using an Indexed File Organization Approach 1500 2501 3317 500 1000 1500 1800 2200 2501 2873 3161 3317 127 275 500 583 729 1000 1179 1320 1500 661 703 717 719 722 723 726 727 729 Master Index Cylinder Index Track Index Track 2 Track 1 Track 3

35 SAD/CHAPTER 1035 Figure 10-10. Division-Remainder Hashing Algorithm The general computation for determining a relative storage address slot for a particular record is: Relative slot address = 1 + Remainder of Primary Key Value _ Total Number of Reserved Address Assume a PRODUCT file with 4, 500 unique records. The storage allocation for this file is equal to the number of records, therefore 4,500 storage slots will be needed on the media. The primary key for records in this file is the PRODUCT_ID field. The location for PRODUCT_ID 734171 can be computed as follows: Relative slot address = 1 + Remainder of 734171 _ = 1 + 671 = 672 4500

36 SAD/CHAPTER 1036 File Volumetrics Analysts must determine the desired storage space for a given file in the database. The concept of volumetrics is intended to address the question of exactly how much data is needed.

37 SAD/CHAPTER 1037 File Volumetrics The size of a file is dependent on: Field data type Record structure Storage media employed Block size File organization scheme

38 SAD/CHAPTER 1038 Table 10-6. Example of Volumetric Analysis for INVOICE File

39 SAD/CHAPTER 1039 Designing the Database Database is a coherent and concise source of data for a variety of users and a variety of applications Database management system is the central nervous system of a database

40 SAD/CHAPTER 1040 Database Architecture Network Hierarchical Relational Object-oriented

41 SAD/CHAPTER 1041 Network Database Model One of the earliest database architectures Each file in the database may be associated with any number of subordinate or superior files

42 SAD/CHAPTER 1042 Figure 10-11. Example of a Network Database Architecture

43 SAD/CHAPTER 1043 Hierarchical Database Model Links the files in the database in the form of a hierarchy A parent file can have many children, but a child file can have only one parent

44 SAD/CHAPTER 1044 Figure 10-12. Example of Hierarchical Database Architecture STUDENT FILE STUDENT FILE ACADEMIC ACTIVITY FILE ACADEMIC ACTIVITY FILE FINANCIAL ACTIVITY FILE FINANCIAL ACTIVITY FILE CURRENT COURSE FILE CURRENT COURSE FILE

45 SAD/CHAPTER 1045 Relational Database Model Can be visualized as a set of two- dimensional tables or spreadsheets made up of column and rows Files are linked together by relations formed via attributes shared by two files

46 SAD/CHAPTER 1046 Figure 10-13. Example of a Relational Database Architecture RELATION A (Primary Key, Attribute 1, Attribute 2, Attribute 3, …) RELATION B (Primary Key, Foreign Key, Attribute 2, Attribute 3, …)

47 SAD/CHAPTER 1047 Object-Oriented Database Model Encapsulates both the attributes associated with an object and the methods that operate on those objects in a structure referred to as an object class Relationship between object classes are shown by nesting one object class inside another - End -

48 SAD/CHAPTER 1048 Chapter Summary The effective design of the physical database is a key element in the successful design and implementation of an organizational IS. The skill of designing and implementing the relational database model will remain viable for many years to come.

49 Chapter 10 End of Chapter


Download ppt "Chapter 10 Designing the Files and Databases. SAD/CHAPTER 102 Learning Objectives Discuss the conversion from a logical data model to a physical database."

Similar presentations


Ads by Google