Document Details

SustainableRiemann

Uploaded by SustainableRiemann

Tags

data modeling database design data structures database management systems

Summary

This document provides a thorough overview of data models, including their importance and the different types of data models used in database design. It details the fundamental concepts of data modeling, focusing on the entity-relationship model and its applications. The document also covers various aspects of data modeling, including business rules, naming conventions, and practical exercises. The focus is on practical application, using examples and diagrams to illustrate the concepts discussed.

Full Transcript

Chapter 2 Data Models ©2017 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part, except for use as permitted in a license distributed with a...

Chapter 2 Data Models ©2017 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website or school-approved learning management system for classroom use. Learning Objectives Data modeling and why data models are important Basic data-modeling building blocks Business rules and their influence on database design How the major data models evolved Levels of abstraction of data models 2 Data Modeling 3 Data Modeling (cont.) Over the years there have been several different semantic data models that have been proposed. Relational data model = Table form Entity-Relationship data model Object-based data model = Object-oriented model + Entity-relationship data model Semi structured data model = XML By far the most common is the entity-relationship data model, most often referred to as simply the E-R data model. The E-R model is often used as a form of communication between database designers and the end users during the developmental stages of a database. 4 Data Models Data model Represent data structures and their characteristics, relations, constraints, transformations, and other constructs with the purpose of supporting a specific problem domain Blueprint to develop a database that meets all end-user requirements. 5 Importance of Data Models 6 Data Model Basic Building Blocks AGENT entity – have many distinguishable agent Example: - Fatimah Azzahra - Lim Yie Jie - Mahendran A person, thing or event 7 Business Rules Brief, precise, and unambiguous Enable defining the description of a basic building policy, procedure, or blocks principle Examples: Describe main and A customer may distinguishing generate many characteristics of the invoices data An invoice is generated by only one customer 8 Business Rules (cont…) Reminder: Business rules establish the basic building blocks of the data model (e.g. entities, attributes, relationships, and constraints) More examples: Relationships: A customer may rent many bicycles. One bicycle is rented by only one customer. Constraints: A student may register for a maximum of four subjects. A training session cannot be scheduled for fewer than 10 employees or for more than 20 employees. 9 Sources of Business Rules 10 Reasons for Identifying Business Rules Help standardize company’s view of data Communications tool between users and designers Allow designer to: Understand the nature, role, scope of data, and business processes Develop appropriate relationship participation rules and constraints Create an accurate data model 11 Translating Business Rules into Data Model Components 12 Naming Conventions Entity names Descriptive, familiar terminology (e.g. STUDENT, STAFF, BOOK) Attribute names Descriptive of the data (e.g. STUDENT_FNAME, BOOK_ISBN) Importance of proper naming: Facilitates communication between parties Promotes self-documentation 13 Exercise!! Entity vs. attributes Car_price Painter Painter_name Employee_name Employee_ID Painting Student_name Birth_date Subject_name Matric_num Painting_ID Plat_number Subject_ID Car Subject_unit Subject Engine_number Student Phone_num Employee Painter_em Date_joined Painting_desc Painting_price Employee_po ail ription sition 14 To properly identify the relationship type for business rules 2 questions should be asked. – How many instances of B are related to one instance of A? – How many instances of A are related to one instance of B? Example, assess the relationship between student and class – How many classes can one student enroll? Answer: many classes – How many students can enroll in one class? Answer: many students 15 Exercise!! Write business rules from basic data model as shown in the figures. Answer: An agent can serve many customers. Each customer is served by one agent. Conclusion: (i) The relational 1:M relationship between AGENT and CUSTOMER. diagram (ii) Linking relational tables 16 The Evolutions of Data Models Emerging XML File hierarchical model (Big Relational OO & O/R hybrid system & network data, DBMS NoSQL) 1960 1970s 1985 – 1990s 2009 17 Hierarchical Mode Represented by an upside-down tree which contains levels (segments) or equivalent of a file system’s record type Describe a set of one-to-many (1:M) relationships Parent segment Children segments Hierarchical database model by Wikipedia (WP:CC BY-SA) 18 Hierarchical Mode Advantages Disadvantages Promotes data sharing Requires knowledge of Parent/child relationship physical data storage promotes conceptual characteristics simplicity and data integrity Navigational system Database security is requires knowledge of provided and enforced by hierarchical path DBMS Changes in structure Efficient with 1:M require changes in all relationships application programs Implementation limitations No data definition Lack of standards 19 Network Model Can represent complex data relationships Improve database performance and impose a database standard Concepts such as schema, subschema, DML, DDL Describe both one-to-many (1:M) and many-to- many (M:N) relationships 20 Network Model Network models are seldom used but its standard database concepts (next slide) are still used today Network model by Wikipedia (WP:CC BY-SA) 21 Standard Database Concepts (interacts) 22 The Evolutions of Data Models (cont…) Data Environment in which data can be managed and is used to manipulation work with the data in the database language Deals with data manipulation includes SQL statements (DML) such as SELECT, INSERT, UPDATE, DELETE Schema data Enables the database administrator to define the definition schema components How the data should be language reside in the database. Example : CREATE, ALTER, (DDL) DROP 23 Network Model (cont…) Advantages Disadvantages Simple concept Requires knowledge of Handles more physical data storage relationship types characteristics Data access is flexible Navigational system Conformance to requires knowledge of standards hierarchical path Has DDL and DML Changes in structure require changes in all application programs Implementation limitations No data definition Lack of standards 24 The Evolutions of Data Models Emerging XML File hierarchical model (Big Relational OO & O/R hybrid system & network data, DBMS NoSQL) 1960 1970s 1985 – 1990s 2009 25 Relational Model Based on a mathematical concept knows as a relation Relation (or table) is a two-dimensional structure with intersecting rows and columns Each row is called a tuple 26 Relational Database Management System (RDBMS) Performs basic functions provided by the hierarchical and network DBMS systems Makes the relational data model easier to understand and implement Hides the complexities of the relational model from the user Examples: Oracle, Microsoft SQL Server, and MySQL 27 Relationships Tables are related to one another through the sharing of a common attribute Figure 2.2 - A Relational Diagram 28 Relational Model (cont…) Advantages Disadvantages Structural independence Requires substantial is promoted using hardware and system independent tables software overhead Simple concept (tabular Untrained people may view) use the system poorly Ad hoc query capability is due to its conceptual based on SQL simplicity Isolates the end user from May promote information physical-level details problems as individual Improves implementation and departments can and management easily develop their own simplicity applications 29 SQL-Based Relational Database Application End-user interface Allows end user to interact with the data Collection of tables stored in the database Each table is independent from another Rows in different tables are related based on common values in common attributes SQL engine Executes all queries 30 The Entity Relationship (ER) Model Complements the relational data model Graphical representation of entities and their relationships in a database structure ER models are represented using an entity relationship diagram (ERD) which have the following components: Entity Attributes Relationships (connectivity – term used to label relationship type) 31 The ER Model Notations 32 Draw: 1. The Crow’s Foot ERD 2. The Chen ERD serves AGENT CUSTOMER Chen model 1 M (i) The relational serves AGENT CUSTOMER diagram (ii) Linking relational tables 33 The ER Model (cont…) Advantages Disadvantages Simple concept Limited constraint (visual modeling) representation Visual Limited relationship representation representation makes it an effective Loss of information communication tool content occurs when Is integrated with the attributes are relational model removed from entities to avoid crowded displays 34 The Evolutions of Data Models Emerging XML File hierarchical model (Big Relational OO & O/R hybrid system & network data, DBMS NoSQL) 1960 1970s 1985 – 1990s 2009 35 The Object-Oriented Data Model (OODM) A basis for object-oriented database management system(OODBMS) Consists of objects that contains attributes, relationships and operations performed on it Attributes describe the properties of an object Typically depicted using Unified Modelling Language (UML) class diagrams Also knows as a semantic data model (semantic = meaning) 36 OODM Terms Class: Collection of similar objects with shared structure and behavior organized in a class hierarchy Class hierarchy: Resembles an upside-down tree in which each class has only one parent 37 OODM Terms (cont.) method 38 OODM Terms (cont.) 39 OODM Terms (cont.) Class: Collection of similar objects with shared structure and behavior organized in a class hierarchy Class hierarchy: Resembles an upside-down tree in which each class has only one parent Inheritance: Each object inherits methods and attributes of parent class 40 OODM Terms (cont.) 41 Comparison of OO, UML, and ER Models 42 OODM (cont…) Advantages Disadvantages Semantic content is Due to slow added development of Visual representation standards, vendors includes semantic use their own content standards, leading to Inheritance promotes compromise of widely data integrity accepted standard Complex navigational system High system overhead slows transactions 43 The Evolutions of Data Models Emerging XML File hierarchical model (Big Relational OO & O/R hybrid system & network data, DBMS NoSQL) 1960 1970s 1985 – 1990s 2009 44 Object / Relational Model and XML Extended relational data model (ERDM) Supports OO features such as inheritance within a simpler relational database model DMBS based on ERDM is knows as an Object/Relational Database Management System (O/R DBMS) Extensible Markup Language (XML) Supported by O/R DBMS Manages unstructured data for efficient and effective exchange of all data types 45 The Evolutions of Data Models Emerging XML File hierarchical model (Big Relational OO & O/R hybrid system & network data, DBMS NoSQL) 1960 1970s 1985 – 1990s 2009 46 NoSQL NoSQL refer to a new generation of databases that address the specific challenges of the Big Data era Characteristics Volume – amounts of data being stored Velocity – refers to speed and the need to process data quickly to generate information Variety – data comes in multiple different data forma Aims to: Find new and better ways to manage large amounts of web and sensor-generated data Provide high performance and scalability at a reasonable cost 47 Big Data Challenges Volume does not allow the usage of conventional structures Expensive OLAP tools proved inconsistent dealing with unstructured data 48 Back to NoSQL Not based on the relational model Support distributed database architectures Provide high scalability, high availability, and fault tolerance Support large amounts of sparse data Geared toward performance rather than transaction consistency Store data in key-value stores 49 NoSQL Databases - A Simple Key-value Representation 50 Big Data Technologies Hadoop Big Data Hadoop Distributed NoSQL New File System Technologies (HDFS) MapReduce 51 NoSQL (cont…) Advantages Disadvantages High scalability, Complex availability, and fault programming is tolerance are required provided No relationship Can use low-cost support storage hardware No transaction Supports Big Data integrity support Key-value model improves storage efficiency 52 The Evolutions of Data Models 53 Summary – Data Model Basic Terminology Comparison 54 Degrees of Abstraction Framework for data modeling based on data abstraction levels: External model Conceptual model Internal model Physical model 55 Degrees of Abstraction (cont…) 56 The External Model End users’ view of the data environment ER diagrams are used External schema: Specific representation of an external view 57 Examples of External Models 58 The Conceptual Model Represents a global view of the entire database by the entire organization Conceptual schema: Specific representation of global view Is software and hardware independent Logical design: Task of creating a conceptual data model 59 Example of Conceptual Model 60 The Internal Model Map conceptual model to DBMS Internal schema: Specific representation of an internal model Uses the database constructs supported by the chosen database Software dependent Logical independence: can change internal model without affecting the conceptual model 61 Example of Internal Model 62 The Physical Model Operates at lowest level of abstraction Describes the way data are saved on storage media physically such as disks or tapes Requires the definition of physical storage and data access methods Physical independence: Changes in physical model do not affect internal model 63 Summary 64

Use Quizgecko on...
Browser
Browser