Lesson 2: ERD, Chen & Crowfoot Notation, and Normalization PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document provides an overview of data design concepts, including data structures, relationships, normalization, and different database approaches. It also covers topics such as file-oriented systems, database management systems (DBMS), and how they differ from each other. 
Full Transcript
Topics: 1. File-oriented Systems 2. Data Design Terminology 3. Data Relationships 4. Entity Relationship Diagram 5. Cardinality And Cardinality Notation 6. Norma...
Topics: 1. File-oriented Systems 2. Data Design Terminology 3. Data Relationships 4. Entity Relationship Diagram 5. Cardinality And Cardinality Notation 6. Normalization 7. Data Warehousing 8. Data Mining 9. Logical And Physical Storage And Records 10. Data Control Measures 1 Objectives Explain file-oriented systems and how they differ from database management systems Explain data design terminology, including entities, fields, common fields, records, files, tables, and key fields Describe data relationships, draw an entity relationship diagram, define cardinality, and use cardinality notation Explain the concept of normalization Explain the importance of codes and describe various coding schemes Explain data warehousing and data mining Differentiate between logical and physical storage and records Explain data control measures 2 MRV Data Design Concepts Data Structures A framework for organizing, storing, and managing data Consists of files or tables that interact in various ways Eachfile or table contains data about people, places, things, or events 3 FIGURE 9-1 Typical data design task list MRV Data Design Concepts Mario and Danica: A Data Design Example Mario’s Auto Shop Mario relies on two file-oriented systems, that store data in separate files that are not connected The MECHANIC SYSTEM uses the MECHANIC file to store data about shop employees FIGURE 9-2 In the example shown The JOB SYSTEM uses the JOB file to store data here, data about the mechanic, the about work performed at the shop customer, and the brake job might be stored in a file-oriented system Danica’s Auto Shop or in a database system Uses a database management system (DBMS) with two separate tables that are joined, so they act like one large table In Danica’s SHOP OPERATIONS SYSTEM, the tables are linked by the Mechanic No field, which is called a common field because it connects the tables 4 MRV Data Design Concepts Mario’s Auto Shop Danica’s Auto Shop FIGURE 9-4 Danica’s SHOP OPERATIONS SYSTEM uses a database design, which avoids duplication. The data can be viewed as if it were one large table, regardless of where the data is stored physically FIGURE 9-3 Mario’s shop uses two separate systems, so certain data must be entered twice. This redundancy is inefficient, and can produce data errors 5 MRV Data Design Concepts Is File Processing Still Important? Handles large volumes of structured data on a regular basis Can be cost-effective Great for transaction processing The Database Environment A database management system (DBMS) is a collection of tools, features, and interfaces that enables users to add, update, manage, access, and analyze data 6 MRV Data Design Concepts FIGURE 9-5 A credit card company that posts thousands of daily transactions might 7 consider a file processing option MRV Data Design Concepts DBMS Advantages Scalability - A system can be expanded, modified, or downsized Economy of scale - Database design allows better utilization of hardware Enterprise-wide application - A database administrator (DBA) assesses overall requirements and maintains the database for the entire Stronger standards - Standards for data names, formats, and documentation are followed uniformly throughout the organization 8 MRV Data Design Concepts DBMS Advantages Better security - The DBA ensures that only legitimate users access the database and different users have different levels of access Data independence - Systems that interact with a DBMS are relatively independent of how the physical data is maintained That design provides the DBA flexibility to alter data structures without modifying information systems that use the data 9 MRV DBMS Components Interfaces for Users, Database Administrators, and Related Systems USERS Typically work with predefined queries and switchboard commands, but also use query languages to access stored data DATABASE ADMINISTRATORS Concerned with data security and integrity, preventing unauthorized access, providing backup and recovery, audit trails, maintaining FIGURE 9-7 In addition to interfaces the database, and supporting user needs for users, database administrators, RELATED INFORMATION SYSTEMS and related information systems, a A DBMS can support several related information DBMS also has a data manipulation systems that provide input to, and require language, a schema and specific data from, the DBMS subschemas, and a physical data repository 10 MRV DBMS Components Data Manipulation Language A data manipulation language (DML) controls database operations, including storing, retrieving, updating, and deleting data Schema The complete definition of a database, including descriptions of all fields, tables, and relationships, is called a schema Physical Data Repository The complete definition of a database, including descriptions of all fields, tables, and relationships, is called a schema 11 MRV Web-Based Data Design Overview A data manipulation language (DML) controls database operations, including storing, retrieving, updating, and deleting data Connecting to the Web The objective is to connect the database to the Web and enable data to be viewed and updated Middleware - software that integrates different applications and allows them to exchange data and interpret client requests in HTML form; then translate the requests into commands that the database can execute Data Security Web-based data must be secure, yet easily accessible to authorized users 12 MRV Web-Based Data Design (Cont.) FIGURE 9-10 When a client workstation requests a Web page (1), the Web server uses middleware to generate a data query to the database server (2). The database server responds (3), and middleware translates the retrieved data into an HTML page that can be sent by the Web server and displayed by the user’s browser (4) 13 MRV Data Design Terms Definitions: ENTITY An entity is a person, place, thing, or event for which data is collected and maintained TABLE OR FILE A table, or file, contains a set of related records that store data about a specific entity FIELD A field, also called an attribute, is a single characteristic or fact about an entity RECORD A record, also called a tuple (rhymes with couple), is a set of related fields that describes one instance, or occurrence, of an entity, such as one customer, one order, or one product 14 MRV Data Design Terms (Cont.) Key Fields: PRIMARY KEY A field or combination of fields that uniquely and minimally identifies a particular member of an entity CANDIDATE KEY Any field that could serve as a primary key is called a candidate key FOREIGN KEY A common field that exists in more than one table and can be used to form a relationship, or link, between the tables SECONDARY KEY A field or combination of fields that can be used to access or retrieve records 15 MRV Data Design Terms (Cont.) Referential Integrity: A set of rules that avoids data inconsistency and quality problems. In a relational database, referential integrity means that a foreign key value cannot be entered in one table unless it matches an existing primary key in another table FIGURE 9-13 Microsoft Access allows a user to specify that referential integrity rules will be enforced in a relational 16 database design MRV Entity-Relationship Diagrams Drawing an ERD The first step is to list the entities that you identified during the systems analysis phase and to consider the nature of the relationships that link them Types of Relationships Three types of relationships can exist between entities: One-to-one One-to-many Many-to-many FIGURE 9-14 In an entity-relationship diagram, entities are labeled with singular nouns and relationships are labeled 17 with verbs. The relationship is interpreted as a simple MRV English sentence. Entity-Relationship Diagrams (Cont.) A one-to-one relationship, abbreviated 1:1, exists when exactly one of the second entity occurs for each instance of the first entity Figure 9-15 shows examples of several 1:1 relationships A number 1 is placed alongside each of the two connecting lines to indicate the 1:1 relationship FIGURE 9-15 Examples of one-to-one (1:1) relationships 18 MRV Entity-Relationship Diagrams (Cont.) A one-to-many relationship, abbreviated 1:M, exists when one occurrence of the first entity can relate to many instances of the second entity, but each instance of the second entity can associate with only one instance of the first entity FIGURE 9-16 Examples of one-to-many (1:M) relationships 19 MRV Entity-Relationship Diagrams (Cont.) A many-to-many relationship, abbreviated M:N, exists when one instance of the first entity can relate to many instances of the second entity, and one instance of the second entity can relate to many instances of the first entity FIGURE 9-17 Examples of many-to-many (M:N) relationships. Notice that the event or transaction that links the two entities is an associative entity with its own set of attributes and 20 characteristics MRV Entity-Relationship Diagrams (Cont.) FIGURE 9-18 An entity- relationship diagram for SALES REP, CUSTOMER, ORDER, PRODUCT, and WAREHOUSE. Notice that the ORDER and PRODUCT entities are joined by an associative entity named ORDER LINE 21 MRV Chen Model (Cont.) 22 MRV Chen Model (Cont.) 23 MRV Entity-Relationship Diagrams (Cont.) Cardinality Describes the numeric relationship between two entities and shows how instances of one entity relate to instances of another entity A common method of cardinality notation is called crow’s foot notation because of the shapes, which include FIGURE 9-19 Crow’s foot notation is a common circles, bars, and symbols, method of indicating cardinality. The four that indicate various possibilities examples show how you can use various symbols to describe the relationships between entities 24 MRV Entity-Relationship Diagrams (Cont.) FIGURE 9-20 In the first example of cardinality notation, one and only one CUSTOMER can place anywhere from zero to many of the ORDER entity. In the second example, one and only one ORDER can include one ITEM ORDERED or many. In the third example, one and only one EMPLOYEE can have one SPOUSE or none. In the fourth example, one EMPLOYEE, or many employees, or none, can be assigned to one PROJECT, or many projects, or none 25 MRV Entity-Relationship Diagrams (Cont.) FIGURE 9-21 An ERD for a library system drawn with Visible Analyst. Notice that crow’s foot notation has been used and relationships are described in both directions 26 MRV Data Normalization Normalization is the process of creating table designs by assigning specific fields or attributes to each table in the database Normalization involves applying a set of rules that can help you identify and correct inherent problems and complexities in your table designs The normalization process typically involves four stages: Unnormalized design First normal form Second normal form Third normal form 27 MRV Data Normalization (Cont.) Standard Notation Format Starts with the name of the table, followed by a parenthetical expression that contains the field names separated by commas. The primary key field(s) is underlined, like this: NAME (FIELD 1, FIELD 2, FIELD 3) A repeating group is a set of one or more fields that can occur any number of times in a single record, with each occurrence having different values 28 MRV Data Normalization (Cont.) FIGURE 9-22 In the ORDER table design, two orders have repeating groups that contain several products. ORDER is the primary key for the ORDER table, and PRODUCT NUMBER serves as a primary key for the repeating group. Because it contains repeating groups, the ORDER table is unnormalized 29 MRV Data Normalization (Cont.) First Normal Form (1NF) A table is in first normal form (1NF) if it does not contain a repeating group When you eliminate the repeating group, additional records emerge — one for each combination of a specific order and a specific product The result is more records, but a greatly simplified design 30 MRV Data Normalization (Cont.) FIGURE 9-23 The ORDER table as it appears in 1NF. The repeating groups have been eliminated. Notice that the repeating group for order 86223 has become three separate records, and the repeating group for order 86390 has become two separate records. The 1NF primary key is a combination of ORDER and PRODUCT NUMBER, which uniquely identifies each record 31 MRV Data Normalization (Cont.) Second Normal Form (2NF) Must understand the concept of functional Dependence Field A is functionally dependent on Field B if the value of Field A depends on Field B A DATE value is functionally dependent on an ORDER, because for a specific order number, there can be only one date Objective is to break the original table into two or more new tables and reassign the fields so that each non-key field will depend on the entire primary key in its table 32 MRV Data Normalization (Cont.) FIGURE 9-24 ORDER, PRODUCT, and ORDER LINE tables in 2NF. All fields are functionally dependent on the primary key 33 MRV Data Normalization (Cont.) Third Normal Form (3NF) A design is in 3NF if every non-key field depends on the key, the whole key, and nothing but the key A 3NF design avoids redundancy and data integrity problems that still can exist in 2NF designs To convert the table to 3NF, you must remove all fields from the 2NF table that depend on another non-key field and place them in a new table that uses the non- key field as a primary key 34 MRV Data Normalization (Cont.) FIGURE 9-25 When the PRODUCT table is transformed from 2NF to 3F, the result is two separate tables: PRODUCT and SUPPLIER. Note that in 3NF, all fields depend on the key, the whole key, and nothing but the key! 35 MRV Two Real-World Examples Example 1: Crossroads College FIGURE 9-27 An initial entity- relationship diagram for ADVISOR, STUDENT, and COURSE FIGURE 9-28 The STUDENT table is unnormalized 36 because it contains a repeating group that represents the courses each student has taken MRV Two Real-World Examples (Cont.) FIGURE 9-29 The STUDENT table in 1NF. Notice that the primary key has been expanded to include STUDENT NUMBER and COURSE NUMBER 37 MRV Two Real-World Examples (Cont.) FIGURE 9-30 The STUDENT, COURSE, and GRADE tables in 2NF. Notice that all fields are functionally dependent on the entire primary key of their respective tables 38 MRV Two Real-World Examples (Cont.) FIGURE 9-31 STUDENT, ADVISOR, COURSE, and GRADE tables in 3NF. When the STUDENT table is transformed from 2NF to 3NF, the result is two tables: STUDENT and ADVISOR 39 MRV Two Real-World Examples (Cont.) FIGURE 9-32 The entity-relationship diagram for STUDENT, ADVISOR, and COURSE after normalization. The GRADE entity was identified during the normalization process. GRADE is an associative 40 entity that links the STUDENT and COURSE tables MRV Working with a Relational Database Suppose you work in IT, and the sales team needs answers to three specific questions Didany customers receive service after 12/14/2013? If so, who were they? Did technician Marie Johnson put in more than six hours of labor on any service calls? If so, which ones? Were any parts used on service calls in Washington? If so, what were the part numbers, descriptions, and quantities? 41 MRV Working with a Relational Database (Cont.) 42 MRV FIGURE 9-35 Question 1 Working with a Relational Database (Cont.) 43 MRV FIGURE 9-36 Question 2 Working with a Relational Database (Cont.) 44 MRV FIGURE 9-37 Question 3 Data Storage and Access Tools and Techniques Companies use data warehousing and data mining as strategic tools to help manage the huge quantities of data they need for business operations and decisions Data warehousing Data mining 45 MRV Data Storage and Access (Cont.) Data Warehousing An integrated collection of data that can include seemingly unrelated information, no matter where it is stored in the company FIGURE 9-42 A data warehouse stores data from several systems. By selecting data dimensions, a user can retrieve specific 46 information without having to know how or where the data is stored MRV Data Storage and Access (Cont.) Data Mining Looks for meaningful data patterns and relationships in large amounts of data FIGURE 9-43 North Carolina State University’s clickable map can take you to a collection of IT ethics issues. Here, the map points to the data mining area 47 MRV Data Storage and Access (Cont.) Logical versus Physical Storage Logicalstorage refers to data that a user can view, understand, and access, regardless of how or where that information actually is organized or stored Physical storage is strictly hardware-related because it involves the process of reading and writing binary data to physical media such as a hard drive, CD-ROM, or network-based storage device 48 MRV Data Storage and Access (Cont.) Data Coding EBCDIC (Extended Binary Coded Decimal Interchange Code - pronounced EB-see-dik) A coding method used on mainframe computers and high- capacity servers ASCII (American Standard Code for Information Interchange - pronounced ASK-ee) A coding method used on most personal computers BINARY Represents numbers as actual binary values, rather than as coded numeric digits 49 MRV Data Storage and Access (Cont.) Data Coding (Cont.) UNICODE Supports virtually all languages and has become a global standard FIGURE 9-44 Unicode is an international coding format that represents characters as integers, using 16 bits50per character. The Unicode Consortium maintains standards and support for MRV Unicode Data Storage and Access (Cont.) Data Coding (Cont.) STORING DATES Y2K Issue International Organization for Standardization (ISO) requires a format of four digits for the year, two for the month, and two FIGURE 9-45 Microsoft Excel uses absolute dates in for the day calculations. In this example, September 27, 2013, is displayed as 41544, and July 13, 2012, is displayed as (YYYYMMDD) 41103. The difference between the dates is 441 days 51 MRV Data Control A well-designed DBMS must provide built-in control and security features, including subschemas, passwords, encryption, audit trail files, and backup and recovery procedures to maintain data 52 MRV Chapter Summary A database consists of linked tables that form an overall data structure A database management system (DBMS) is a collection of tools, features, and interfaces that enable users to add, update, manage, access, and analyze data in a database DBMS designs are more powerful and flexible than traditional file- oriented systems DBMS components include interfaces for users, database administrators, and related systems; a data manipulation language; a schema; and a physical data repository In an information system, an entity is a person, place, thing, or event for which data is collected and maintained A primary key is the field or field combination that uniquely and minimally identifies a specific record; a candidate key is any field that could serve as a primary key 53 MRV Chapter Summary (Cont.) An entity-relationship diagram (ERD) is a graphic representation of all system entities and the relationships among them The relationship between two entities also is referred to as cardinality Normalization is a process for avoiding problems in data design Data design tasks include creating an initial ERD; assigning data elements to an entity; normalizing all table designs; and completing the data dictionary entries for files, records, and data elements 54 MRV Chapter Summary (Cont.) A code is a set of letters or numbers used to represent data in a system Logical storage is information seen through a user’s eyes, regardless of how or where that information actually is organized or stored Physical storage is hardware related and involves reading and writing binary data to physical media File and database control measures include limiting access to the data, data encryption, backup/recovery procedures, audit-trail files, and internal audit fields 55 MRV