Presentation is loading. Please wait.

Presentation is loading. Please wait.

Common Field Types Primary Key Descriptive Fields Foreign Key.

Similar presentations


Presentation on theme: "Common Field Types Primary Key Descriptive Fields Foreign Key."— Presentation transcript:

1 Common Field Types Primary Key Descriptive Fields Foreign Key

2 Referential Integrity CUSTOMER (Customer ID, LastName, FirstName, Address, City, State, Zipcode) ORDER (Order ID, Customer ID, OrderDate)

3 Field Sequencing WRONG RIGHT

4 Fixed Length Record with Provision for Multiple Vendors Potentially Wasted Storage Space

5 Variable Length Record with Provision for Multiple Vendors Indicator for number of Vendor Fields

6 Blocking Factor Record 1 Sector Without Blocking Unused Storage Space Record 5 Record 4 Record 3 Record 2 Record 1 512 bytes Sector With Blocking

7 Record Spanning 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

8 Sequential File Organization Physical Record Position in File Record Primary Key

9 Indexed File Organization 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

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 Slots 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

11 Network Database Architecture CUSTOMER FILE CUSTOMER FILE ORDER FILE ORDER FILE ORDERED_ITEM FILE ORDERED_ITEM FILE PRODUCT FILE PRODUCT FILE

12 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

13 Relational Database Architecture RELATION A (Primary Key, Attribute 1, Attribute 2, Attribute 3, …) RELATION B (Primary Key, Foreign Key, Attribute 2, Attribute 3, …)

14 Object-Oriented Database Architecture Methods Object Class A Object Attributes Methods Object Class C Object Attributes Object Class B Object Attributes Methods

15 Common Data Type Definitions Data TypeDescription CHAR( n ) Alphanumeric character array with a maximum length of n. DECIMAL( m,n ) Signed numerical data with a total number of digits, m, and n number of digits to the right of the decimal point. VARCHAR Alphanumeric character array of variable length. INTEGER Signed whole number typically up to 11 digits in length SMALLINT Signed whole number up to 5 or 6 digits in length. DATE Date and time including appropriate validity checks (i.e. 4-31 not allowed). NUMBER Real number FLOAT( m,n ) Numerical data represented in scientific notation with a total number of digits, m, and n number of digits to the right of the decimal point. LOGICAL Binary data (i.e. TRUE/FALSE, YES/NO) LONG Variable length alphanumeric character array up to 2Gb LONGRAW Binary large object (BLOB) – no assumptions are made about format or content.

16 Common Field-Level Data Specifications Field SpecificationDescription Field Name Formal name for the field that uniquely identifies it from all others. Data Type Data type associated with this field. Units The unit of measure associated with this field (if applicable). Maintenance Rules for update, change, or deletion once data is entered (i.e. accounting transaction data cannot be changed once entered). Missing Data Procedure for handling missing data during multiple record processing (i.e. IGNORE, USE AVERAGE OF OTHER RECORDS). Check Digit Algorithm for calculate and verifying any check digits used in this field. Formula Algorithm for computing the value of this field (if calculated). Coding Coding conventions or acceptable abbreviations (i.e. 2-character abbreviation for State). Domain/Range Specification of range limits or default values for the field. Referential Integrity Specification for any referential integrity constraints for the field. Data Owner Identification of the responsible party for identifying the source and meaning of data contained in this field.

17 Common Domain Controls Domain ControlDescription Default Value Automatic entry of a value commonly found for this field unless other data is entered. Range Control Imposition of acceptable or relevant limits on either alphanumeric or numerical data. Picture Control Imposition of a specific pattern for the data being entered (i.e. DATE= mm/dd/yy or dd-mm-yyyy) Null Value Control Specification of whether a value in a particular field is required or optional.

18 Examples of Referential Integrity Deletion Rules Deletion RuleExplanation NO RESTRICTION Any record in the file may be deleted without regard to any other record or file. DELETE:CASCADE A deletion of a record must be automatically followed by the deletion of any matching records in any related files. DELETE:RESTRICT A deletion of a record in a table must be disallowed until any matching records are deleted from any related files. DELETE:SET NULL A deletion of a record must be automatically followed by setting any matching keys in a related file to NULL.

19 Common File Types File TypeDescription Master File Contains records related to business data that is relatively permanent. Once a record is entered, it tends to remain indefinitely. Data values may change (i.e. CUSTOMERS, PRODUCTS, INVOICES, SUPPLIERS). Transaction File Contains records that describe business events which can occur on a day- to-day basis. Data tends to have a limited useful life and are usually moved to an archival file after a predetermined period. Document File Contains stored copies of historical data in document form such that the overhead associated with recreated or reprocessing the document is eliminated. Table Look-Up File Contains reference data used to validate field values and to maintain consistency throughout the database (INCOME TAX TABLES, POSTAL CODE TABLES). Audit File Contains records of updates to other files in the database in case production files are damaged and require reconstruction. Data can be used with records in archival files to recover or restore damaged files or lost data. Archive File Contains records that have been deleted from active transaction files but require retention for an indefinite period. Work File Contains records stored temporarily or records containing intermediate results in a calculation process. Work files are usually created when needed and deleted upon completion of the task.

20 Volumetric Analysis FIELD SIZE (bytes) Invoice_ID7 Invoice_Date 8 Customer_ID 6 Product_ID9 Quantity3 Unit_Price6 Salesman_ID 4 Record Size 43 Record Overhead25% Total Record Size53.75 Total Annual Record Volume 67,000 Expected Table Volume 3,601,250 Expected Annual Growth Rate 16% Projected Table Volume – 4 years 5,621,176


Download ppt "Common Field Types Primary Key Descriptive Fields Foreign Key."

Similar presentations


Ads by Google