Sahar Mosleh California State University San MarcosPage 1 Relational Data Model.

Slides:



Advertisements
Similar presentations
CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Advertisements

The Hierarchical Model
Information Systems Chapter 2 Organizing Data and Information.
IS605/606: Information Systems Instructor: Dr. Boris Jukic
Access Trisha Cummings. Access 1.Microsoft Access is a relational database management system from Microsoft, 2.Skilled software developers and data architects.
Chapter Information Systems Database Management.
Database Design University of California, Berkeley
Advanced Summary Queries CIT October 24.
Organizing Data & Information
The Relational Database Model:
Concepts of Database Management Sixth Edition
Attribute databases. GIS Definition Diagram Output Query Results.
8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:
10/3/2000SIMS 257: Database Management -- Ray Larson Relational Algebra and Calculus University of California, Berkeley School of Information Management.
Academic Year 2014 Spring.
APPENDIX C DESIGNING DATABASES
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
LECTURE 2 DATABASE SYSTEM CONCEPTS AND ARCHITECTURE.
Database Design and Introduction to SQL
IST Databases and DBMSs Todd S. Bacastow January 2005.
INTRODUCTION TO DATABASE USING MS ACCESS 2013 PART 2 NOVEMBER 4, 2014.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
Module Title? DBMS E-R Model to Relational Model.
44220: Database Design & Implementation Logical Data Modelling Ian Perry Room: C48 Tel Ext.: 7287
Chapter 4 The Relational Model.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
By: M.Nadeem Akhtar1 The Data Base Management System (DBMS) Ch # 09.
RAJIKA TANDON DATABASES CSE 781 – Database Management Systems Instructor: Dr. A. Goel.
Copyright  Oracle Corporation, All rights reserved. I Introduction.
Concepts of Database Management, Fifth Edition Chapter 4: The Relational Model 3: Advanced Topics.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
2005 SPRING CSMUIntroduction to Information Management1 Organizing Data John Sum Institute of Technology Management National Chung Hsing University.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
GUS: 0262 Fundamentals of GIS Lecture Presentation 3: Relational Data Model Jeremy Mennis Department of Geography and Urban Studies Temple University.
 Data Model Data Model  Categories of Data Models Categories of Data Models  Object Based Data Models Object Based Data Models  Physical Data Models.
Announcements. Data Management Chapter 12 Traditional File Approach  Structure Field  Record  File  Fixed All records have common fields, and a field.
1 Database Concepts 2 Definition of a Database An organized Collection Of related records.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Relational Database. Database Management System (DBMS)
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
 2001 Prentice Hall Business Publishing, Accounting Information Systems, 8/E, Bodnar/Hopwood A field may be a single character or number, or it.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
1 Database & DBMS The data that goes into transaction processing systems (TPS), also goes to a database to be stored and processed later by decision support.
Chapter 10 Designing the Files and Databases. SAD/CHAPTER 102 Learning Objectives Discuss the conversion from a logical data model to a physical database.
Relational Database. I. Relational Database 1. Introduction 2. Database Models 3. Relational Database 4. Entity-Relationship Models 5. RDB Design Principles.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
GIS Data Models GEOG 370 Christine Erlien, Instructor.
Use of ICT in Data Management AS Applied ICT. Back to Contents Back to Contents.
Sahar Mosleh California State University San MarcosPage 1 Database Design and Administration By: Sahar Mosleh.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
Lection №4 Development of the Relational Databases.
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Databases Chapter Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
CIS 250 Advanced Computer Applications Database Management Systems.
Object storage and object interoperability
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 7 Storing Organizational Information - Databases.
Introduction to Databases Angela Clark University of South Alabama.
Database Systems Logical Data Modelling Tutor:Ian Perry Tel: Web:
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
Before the Relational Model COMP3211 Advanced Databases Dr Nicholas Gibbins –
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Data Models. 2 The Importance of Data Models Data models –Relatively simple representations, usually graphical, of complex real-world data structures.
DBS201: Data Modeling. Agenda Data Modeling Types of Models Entity Relationship Model.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Introduction to Database Programming with Python Gary Stewart
Databases and DBMSs Todd S. Bacastow January
Legacy Databases.
Presentation transcript:

Sahar Mosleh California State University San MarcosPage 1 Relational Data Model

Sahar Mosleh California State University San MarcosPage 2 Data Model Structures and access techniques provided by a particular database management system (DBMS) are called its data model DBMS became popular from 1970 to 1980 Each model had its advantages and its disadvantages In many ways the relational data model represented an attempt to simplify the earlier data models

Sahar Mosleh California State University San MarcosPage 3 File Management Systems Before the existence of DBMS, the data were stored in separate files. There was no link from one file to another If the structure of the data changed (ex: adding more fields), programs that were using the file had to change Problems became more severe when the number of the programs using the files increased over time

Sahar Mosleh California State University San MarcosPage 4 Employee Update Program FD Check-writing Program FD Employee Master File Timecard File Employee Report Program FD This is an example of payroll application using a file management System. (FD is the file descriptor in the picture) EmpId EmpName Address City ………………. EmpId HoursWorked Wage ………………. EmpId EmpName Address City ……………….

Sahar Mosleh California State University San MarcosPage 5 Hierarchical Database One of the most important application for the earliest database management system was production of manufacturing companies such as car companies Car companies wanted to produce units of one model, 5000 of another model and so on. They needed a database to collect all of this information and required tools to retrieve the information as fast as possible. Information had to be organized in a form of parent and child structure: a car is composed of a motor, body, etc. Similarly each subpart were composed of other subparts and so on. Ex: an engine has spark plugs, wires, etc..

Sahar Mosleh California State University San MarcosPage 6 Car1 Engine Left Door Handle …... …… Body Transmission right Door Roof Hood WindowLock Car2 Engine Left Door Handle …... …… Body Transmission right Door Roof Hood WindowLock Car3 Engine Left Door Handle …... …… Body Transmission right Door Roof Hood WindowLock ….. ….

Sahar Mosleh California State University San MarcosPage 7 Hierarchical model uses upside down trees. A tree represents parent/child relationships For example, a car consists of body, engine, transmission, etc. The root of the tree and all of its associated children would make one record (specifying a particular item: i.e a car) Pointers were used to link a parent to its children or a child to another child In general, to access the data, a program would Find a particular car Move down to the first child Move up to its parent Move sideways to the next child Retrieving the data in a hierarchical database required navigating through the records, moving up, down, and sideways one record at the time The most popular hierarchical database was Information Management System (IMS) introduced in 1968

Sahar Mosleh California State University San MarcosPage 8 Advantages of Hierarchical database: Simple Structure: Organization of IMS database was easy to understand Parent/Child Organization: IMS was a good model for representing parent/child relationship (A is part of B) or (A is owned by B) Performance: IMS stored parent/child relationships as physical pointers from one data record to another This would speed up the movement from one record to another IMS is still widely used. It is still considered as a good DBMS in places with lots of transactions processing (ex: banks)

Sahar Mosleh California State University San MarcosPage 9 Network Databases Hierarchical database could not answer the demand of some business oriented environment. For example, in an order processing company, a single order might participate in more than one parent/child relationship. For instance, a particular order should be linked to The customer who placed it The sales person who took it The product ordered This could not be done by IMS To deal with these situations, network data model was developed: children could have more than one parent

Sahar Mosleh California State University San MarcosPage 10 Car # Car Bill Adams Car Acme Mfg Car Size 4 Widget Orders Customers Salespeople Products Example of parent/child relationship in network database models

Sahar Mosleh California State University San MarcosPage 11 In 1971, the conference on the systems languages published an official standard for network databases which became known as CODASYL model A programmers would access the network database as follows: Find a specific parent record by key (ex: customer number) Move down to the first child in a particular set (the first order placed by this customer Move sideways from one child to the next in the set (the next order placed by this customer) Move up from a child to its parent in another set ( the salesperson who took the order)

Sahar Mosleh California State University San MarcosPage 12 Advantages of Network database Flexibility: Multiple parent/child relationships allowed a network database to represent data that did not have a simple hierarchical structure Standardization: The CODASYL standard boosted the popularity of the network model, and minicomputer vendors such as Digital Equipment Corporation and Data General implemented network Databases Performance: Despite their greater complexity, network databases boasted performance approaching that of hierarchical databases.

Sahar Mosleh California State University San MarcosPage 13 Disadvantages of Hierarchical and Network models They have rigid structure: The structure of the records had to be known in advance. Changing the database structure required rebuilding the entire database Querying the database was not always easy. Retrieving simple information form the database could cause programmer to write lots of code Some of this code was quite complicated

Sahar Mosleh California State University San MarcosPage 14 Relational Data Model Disadvantages of hierarchical and network models led to creation of Relational Data Model by Dr. Codd in 1970 In this course, we teach Relational data model and use Structured Query Language (SQL) used to manipulate the data in the database. Definition: A relational database is a database where all data visible to users is organized strictly as tables of data values and where all database operations work on these tables In this model information is stored in a database as simple row/column tables of data Next slide shows an example of tables in a relational database

Sahar Mosleh California State University San MarcosPage 15 Salesrep Name Age RepOffice Title HireDate Manager Quota Sales 105 Bill Adams Sales Rep 12-FEB Mary Jones Sales Rep 12-OCT Sue Smith Sales Rep 10-DEC Sam Clark VP Sales 14-JUN Bob Smith Sales Mgr 19-MAY Dan Roberts Sales Rep 20-OCT Tom Synder 41 Sales Rep 13-JAN Larry Fitch Sales Mgr 12-OCT Paul Cruz Sales Rep 01-MAR Nacy Angelli Sales Rep 14-NOV …. SalesReps OrderNum OrderDate Cust Rep MFR Product QTY Amount DEC REI 2A44L JAN ACI JAN FEA FEB QSA K OCT ACI JAN ACI 4100Z FEB REI 2A44R DEC ACI JAN BIC FEB FEA JAN BIC DEC ACI JAN QSA XK FEB FEA OCT ACI 4100Z …… Orders MfrId ProductId Description Price QtyOnHand REI 2A45C RATCHET LINK ACI 4100Y WIDGET REMOVER QSA XK47 REDUCER BIC PLATE IMM 779C 900-LB BRACE ACI SIZE 3 WIDGET ACI SIZE 4 WIDGET BIC HANDLE IMM 887P BRACE PIN QSA XK48 REDUCER REI 2A44L LEFT HINGE …. Products CustNum Company CustRep Credit_limit 2111 JCP Inc First Corp Acme Mfg Carter and Sons Ace International Smithson Corp Jones Mfg Zetacorp QMA Assoc Orion Corp …… CustomersOffices Office City Region Mgr Target Sales 22 Denver Western New York Eastern Chicago Eastern Atlanta Eastern Los Angeles Western

Sahar Mosleh California State University San MarcosPage 16 Table Definition: A table is a rectangular object with rows and columns For example in the office table: Each row of the office table represents a single physical entity Each column of the offices table represents one item of data that is stored in the database for each office: Ex: City column represents the location of the office An alternative term for column is attribute Each row of the table contains exactly one data value in each column

Sahar Mosleh California State University San MarcosPage 17 In each column of a table, all of the data values in that column have the same type. For example: City column values are words Sales values are money type Mgr values are integer Each column in a table has a column name which is written as a heading at the top of the column Column names must be unique in a table The columns of a table have a left-right order. That is defined when the table is first created. The order of the column has no effect when any action is done against the table

Sahar Mosleh California State University San MarcosPage 18 Each table must have at least one column Almost all commercial DBMS products impose maximum of 255 columns per table A table can have zero or more rows A table with zero rows is called an empty table Order of the rows is not important in a table. Most relational DBMSs either do not impose any limit on the number of rows or their limit is a very large number A common limit is approximately 2 billion rows

Sahar Mosleh California State University San MarcosPage 19 Primary Key Definition: A primary key is a column or combination of two or more columns that uniquely identifies each row of a table. Since the order of rows in a table is irrelevant, rows cannot be identified based on their positions in a table Ex: row 1, row 2, row 20 In a well-designed relational database each table has a primary key. If the primary key contains two or more columns, it is called a composite primary key

Sahar Mosleh California State University San MarcosPage 20 Example of primary key Consider the Offices table “Office” column (attribute) can be a good choice for the primary key because each office has a different office id However, city is not a good choice because more than one office may be located in the same city. Office City Region Mgr Target Sales 22 Denver Western New York Eastern Chicago Eastern Atlanta Eastern Los Angeles Western

Sahar Mosleh California State University San MarcosPage 21 Consider the Products table MfrId ProductId Description Price QtyOnHand REI 2A45C RATCHET LINK ACI 4100Y WIDGET REMOVER QSA XK47 REDUCER BIC PLATE IMM 779C 900-LB BRACE ACI SIZE 3 WIDGET ACI SIZE 4 WIDGET BIC HANDLE IMM 887P BRACE PIN QSA XK48 REDUCER REI 2A44L LEFT HINGE …. What is a good primary key for this table?

Sahar Mosleh California State University San MarcosPage 22 In his case, MrfId by itself, is not a good choice to be a primary key because more than one manufacturer may produce more than one product Further, ProductId by itself is not a good choice either because the same product can be produced by more than one manufacturer. However, combination of both is unique in every row. This is an example of composite primary key. A table with a primary key is called a relation. A relation is a table in which no duplicate rows can exist.

Sahar Mosleh California State University San MarcosPage 23 Relationship In contrast with the older data models (hierarchical and network models) relational data models do not include explicit parent/child pointer connection Then how does the parent/child model is represented in the relational data model? Consider the following two tables Salesrep Name Age RepOffice Title HireDate Manager Quota Sales 105 Bill Adams Sales Rep 12-FEB Mary Jones Sales Rep 12-OCT Sue Smith Sales Rep 10-DEC Sam Clark VP Sales 14-JUN …. SalesRepsOffices Office City Regin Mgr Target Sales 22 Denver Western New York Eastern Chicago Eastern Atlanta Eastern Los Angeles Western

Sahar Mosleh California State University San MarcosPage 24 The parent is the offices table The child is the salesreps table because the salesreps works in an office Relationships are created by having the same data in two or more tables Salesrep Name Age RepOffice Title HireDate Manager Quota Sales 105 Bill Adams Sales Rep 12-FEB Mary Jones Sales Rep 12-OCT Sue Smith Sales Rep 10-DEC Sam Clark VP Sales 14-JUN …. SalesRepsOffices Office City Regin Mgr Target Sales 22 Denver Western New York Eastern Chicago Eastern Atlanta Eastern Los Angeles Western

Sahar Mosleh California State University San MarcosPage 25 Note that the RepOffice column salesreps table contains the office number of the sales office where each sales person works The values of the RepOffice column is the set of office numbers found in the office column of the offices table We will see how this restriction is imposed when we discuss about creating tables later in the course For example, it is possible to find the sales office where “Mary Jones” is working by finding the value of Mary Jones RepOffice (11) and finding the corresponding row offices table So, the parent/child relationship between two tables A and B is not represented by explicit pointers but by common data values stored in the two tables Programmers must specify this relationship when they create the tables

Sahar Mosleh California State University San MarcosPage 26 Foreign Key Definition: Foreign key is a column (or combination or two or more columns) whose value matches the primary key of another table Together, primary key and the foreign key make the parent/child relationship in relational data models Salesrep Name Age RepOffice Title HireDate Manager Quota Sales 105 Bill Adams Sales Rep 12-FEB Mary Jones Sales Rep 12-OCT Sue Smith Sales Rep 10-DEC Sam Clark VP Sales 14-JUN …. SalesRepsOffices Office City Regin Mgr Target Sales 22 Denver Western New York Eastern Chicago Eastern Atlanta Eastern Los Angeles Western Primary key Foreign key

Sahar Mosleh California State University San MarcosPage 27 Example of Foreign Key Salesrep Name 105 Bill Adams 109 Mary Jones 102 Sue Smith 106 Sam Clark …. SalesReps OrderNum OrderDate Cust Rep MFR Product QTY Amount DEC REI 2A44L JAN ACI JAN FEA FEB QSA K …. Orders MfrId ProductId REI 2A45C ….. ACI 4100Y ….. QSA XK47 …… …. ….. Products CustNum 2111 … … …. ………. ……. Customers