GUS: 0262 Fundamentals of GIS Lecture Presentation 3: Relational Data Model Jeremy Mennis Department of Geography and Urban Studies Temple University.

Slides:



Advertisements
Similar presentations
C6 Databases.
Advertisements

ETEC 100 Information Technology
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Key.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
3-1 Chapter 3 Data and Knowledge Management
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
“DOK 322 DBMS” Y.T. Database Design Hacettepe University Department of Information Management DOK 322: Database Management Systems.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Attribute databases. GIS Definition Diagram Output Query Results.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
IST Databases and DBMSs Todd S. Bacastow January 2005.
The Relational Database Model
Database Lecture # 1 By Ubaid Ullah.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
Attribute Data in GIS Data in GIS are stored as features AND tabular info Tabular information can be associated with features OR Tabular data may NOT be.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
6-1 DATABASE FUNDAMENTALS Information is everywhere in an organization Information is stored in databases –Database – maintains information about various.
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
Database Technical Session By: Prof. Adarsh Patel.
STORING ORGANIZATIONAL INFORMATION— DATABASES CIS 429—Chapter 7.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
6 Chapter Databases and Information Management. File Organization Terms and Concepts Bit: Smallest unit of data; binary digit (0,1) Byte: Group of bits.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
10/17/2012ISC471/HCI571 Isabelle Bichindaritz 1 Technologies Databases.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
1.file. 2.database. 3.entity. 4.record. 5.attribute. When working with a database, a group of related fields comprises a(n)…
Storing Organizational Information - Databases
C6 Databases. 2 Traditional file environment Data Redundancy and Inconsistency: –Data redundancy: The presence of duplicate data in multiple data files.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
1 Introduction to Oracle Chapter 1. 2 Before Databases Information was kept in files: Each field describes one piece of information about student Fields.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
Database Systems, 9th Edition 1.  In this chapter, students will learn: That the relational database model offers a logical view of data About the relational.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Database Fundamentals CSC105 Furman University Peggy Batchelor.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
GIS Data Models GEOG 370 Christine Erlien, Instructor.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 3 The Relational Database Model.
1 Geog 357 – Introduction to GIS The Relational Language.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
1 Geog 357: Data models and DBMS. Geographic Decision Making.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
Howard Paul. Sequential Access Index Files and Data File Random Access.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant EPS
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Databases and DBMSs Todd S. Bacastow January
Information Systems Today: Managing in the Digital World
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Relational Model Characteristics
Chapter 4 Relational Databases
Database.
Database Design Hacettepe University
Database Systems: Design, Implementation, and Management
Presentation transcript:

GUS: 0262 Fundamentals of GIS Lecture Presentation 3: Relational Data Model Jeremy Mennis Department of Geography and Urban Studies Temple University

File Structures 3 Smith Jane A 1 Wood Bob C 2 Kent Chuck B 4 Boone Dan B ID Last First Grade record field A file: “STUDENT”

File Structures Simple ordering is based on order of entry into the file Ordered Sequential ordering is based on numeric or alphabetical ordering Indexed an index provides pointers to certain positions in the file

Databases and Data Models A database is a collection of data files that is structured (organized) to facilitate data storage, manipulation, and retrieval. A database management system (DBMS) is a software package that performs these database functions

Databases and Data Models A data model is a particular way of conceptually organizing multiple data files in a database: Hierarchical, Network, Relational Hierarchical and network data models have generally been replaced by the relational data model. Relational DBMSs (and their derivatives) dominate the (non-GIS) database market: Oracle, Informix.

Relational Data Model Composed of a set of tables called relations Records (rows) in the table are called tuples Fields (columns) in the table are called domains We will use the terms tables, records, and fields

Relational data model Each record represents a logical entity (e.g. a student) (or a relationship) Each field represents an attribute (property) of the logical entity 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student

Relational data model Each table has a primary key, one field (or a combination of fields) that has a unique value for each and every record in the table 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student

Relational data model Tables can be related (joined or linked) together based on their keys. 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student Geog Mennis Geog Brower Geog Fountain Class Name #Stud Instructor

Relational data model 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student Geog Mennis Geog Brower Geog Mennis Class Name #Stud Instructor Primary key Foreign key

Relational data model 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student Geog Brower Geog Mennis Geog Mennis Class Name #Stud Instructor Mennis 332 Brower 517 Instructor Name Office

Normal Forms The process of structuring tables and table relationships in a logical way that minimizes data redundancy. 3 rules or steps in normalization first normal form second normal form third normal form

Normal Forms First normal form only one value per field for each record 1 Wood Bob C, B Geog357, Geog20 2 Kent Chuck B, D Geog115, Geog356 3 Smith Jane A, B Geog357, Geog20 4 Boone Dan B, A Geog357, Geog455 ID Last First Grades Classes Student Violates first normal form

Normal Forms Second normal form each non-primary key field must be totally dependent on the entire primary key (and not on only part of the primary key) 2 Wood Bob C sophomore 4 Kent Chuck B senior 3 Smith Jane A junior 3 Boone Dan B junior Year Last First Grade Status Student Violates second normal form because Status is dependent only on Year, not on Year/Last/First primary key

Normal Forms To resolve second normal form violation - create separate tables Wood Bob C2 Kent Chuck B 4 Smith Jane A 3 Boone Dan B3 Last First Grade Year Student 1 freshman 2sophomore 3junior 4senior YearStatus Wood Bob C Kent Chuck B Smith Jane A Boone Dan B Last First Grade Year primary key

Normal Forms 1 Wood Bob C Geog357 Mennis 2 Kent Chuck B Geog115 Brower 3 Smith Jane A Geog357 Mennis 4 Boone Dan B Geog357 Mennis ID Last First Grade Class Instructor Student Third normal form every field that is not a primary key must be totally and directly dependent on the primary key (no transitive dependency)

Normal Forms 1 Wood Bob C Geog357 Mennis 2 Kent Chuck B Geog115 Brower 3 Smith Jane A Geog357 Mennis 4 Boone Dan B Geog357 Mennis ID Last First Grade Class Instructor Student Third normal form every field that is not a primary key must be totally and directly dependent on the primary key (no transitive dependency) Violates third normal form because Instructor is dependent on Class, not on the primary key ID

Normal Forms To resolve third normal form violation - create separate tables 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Student Geog Mennis Geog Brower Geog Mennis Class Name #Stud Instructor Class is dependent on primary key ID Instructor is dependent on primary key Name

Why Normalization? 1 Wood Bob C Geog357 Mennis 2 Kent Chuck B Geog115 Brower 3 Smith Jane A Geog357 Mennis 4 Boone Dan B Geog357 Mennis ID Last First Grade Class Instructor Student 1. If the instructor to a class changed - all students with that class would have to have their instructors changed 2. Every time a student changed a class, the instructor would also have to be changed

Why Normalization? 1 Wood Bob C Geog115 Mennis 2 Kent Chuck B Geog115 Brower 3 Smith Jane A Geog357 Knight 4 Boone Dan B Geog357 Mennis ID Last First Grade Class Instructor Student Logical inconsistency 1 Wood Bob C Geog357 Mennis 2 Kent Chuck B Geog115 Brower 3 Smith Jane A Geog357 Mennis 4 Boone Dan B Geog357 Mennis ID Last First Grade Class Instructor These update problems may result in logical inconsistencies in the database Original table Updated table

Why Normalization? When the table is in third normal form, these logical inconsistencies cannot take place. When an instructor is changed, the change is enforced for all students When a student changes classes, the change is instructor is automatically enforced 1 Wood Bob C Geog357 2 Kent Chuck B Geog115 3 Smith Jane A Geog357 4 Boone Dan B Geog357 ID Last First Grade Class Geog Mennis Geog Brower Geog Mennis Class Name #Stud Instructor

Relational Algebra Operations on the relational data model are defined by relational algebra join projection selection

Relational Algebra Join: Match records in both tables based on a common field Geog357 Mennis Geog115 Brower Geog20 Fountain Geog435 Karnes Class Instructor Geography Classes Mennis 332 Brower 423 Fountain 125 Karnes 312 Instructor Office Instructor Geog357 Mennis 332 Geog115 Brower 423 Geog20 Fountain 125 Geog435 Karnes 312 Class Instructor Office Result of Join

Relational Algebra Projection: reduces one table in the attribute dimension (a selection of a subset of fields, for all records)

Projection: List all Geography classes, but not the instructors Geog357 Mennis Geog115 Brower Geog20 Fountain Geog435 Karnes Class Instructor Geography Classes Relational Algebra Geog357 Geog115 Geog20 Geog435 Class Result of Projection

Relational Algebra Selection (restriction): reduces one table in the record dimension (a selection of a subset of records, for all fields) Criteria for selection is called a predicate

Selection: Find Geography classes taught by Mennis Geog357 Mennis Geog115 Brower Geog20 Fountain Geog435 Karnes Class Instructor Geography Classes Relational Algebra Result of Selection Geog357 Mennis Class Instructor

SQL –Structured (Standard) Query Language –Formal language for interacting with relational databases –Implementation and language for relational algebra

SQL SQL - basic syntax SELECT FROM WHERE SELECT Class, Instructor FROM Geography Classes WHERE Instructor = “Mennis” Geog357 Mennis Geog115 Brower Geog20 Fountain Geog435 Karnes Class Instructor Geography Classes Result of Selection Geog357 Mennis Class Instructor

SQL SELECT Class, Office FROM Geography Classes, Instructor WHERE Class = “Geog357” or Instructor = “Karnes” or Office = 125 ORDER BY Office Geog357 Mennis Geog115 Brower Geog20 Fountain Geog435 Karnes Class Instructor Geography Classes Mennis 332 Brower 423 Fountain 125 Karnes 312 Name Office Instructor Geog Geog Geog Class Office Result of SQL Query