Lab Exercise This Week PHP Basics See last Friday’s slides for requirements Make sure you show the final results to TA to get credit 1IST210.

Slides:



Advertisements
Similar presentations
The Relational Model DB Chapter 2 (and some from chapter 4, 5) J.G. Zheng June 27 th 2005.
Advertisements

The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 7 th Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
The Relational Model Chapter Two. 2 Chapter Objectives Learn the conceptual foundation of the relational model Learn the conceptual foundation of the.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
The Relational Model CIS 218. Entity A Person, Place, Thing or Transaction Something the user wants to track.
Chapter 14 Getting to First Base: Introduction to Database Concepts.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke Database Processing Chapter 3 Normalization.
The Relational Model Chapter Two (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
Chapter 2. The Relational Model (cont.) IST2101. Review: Functional Dependency A relationship between attributes: some attribute(s) determine the value.
Concepts of Database Management Seventh Edition
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
Microsoft Access 1 Database Creation and Management.
N. J. Taylor Database Management Systems (DBMS) 1.
Database Principles Relational Database Design I.
Chapter 3 The Relational Model and Normalization
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 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.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
R ELATIONAL D ATA M ODEL Joe Meehean 1. R ELATIONAL D ATA M ODEL Data stored as a set of relations really just tables Tables related to one another through.
Chapter 4 The Relational Model and Normalization.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, Modified by Dr. Mathis 3-1 David M. Kroenke’s Chapter Three: The Relational.
IST 210: ORGANIZATION OF DATA Chapter 1. Getting Started IST210 1.
The Relational Model Chapter Two DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber.
Natural vs. Generated Keys. Definitions Natural key—a key that occurs in the data, that uniquely identifies rows. AKA candidate key. Generated key—a key.
Session 8: Databases Teaching Computing to GCSE Level with Python.
Chapter 2. The Relational Model IST2101. Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
Slide 1 Chapter 03 The Relational Model and Normalization.
The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems.
1 The Information School of the University of Washington Dec 1fit advdatabases © 2006 University of Washington Advanced Database Concepts INFO/CSE.
Chapter 2. The Relational Model (cont.)
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Chapter 2. The Relational Model (cont.) IST2101. Review: Determinant vs. Candidate Key IST2102 DeterminantsCandidate Key (StudentID, CourseID) StudentID.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
+ Relational Model IST210 Class Lecture. + Premiere Products A new company that is going to sells random merchandise via sales representatives You have.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
Assignment 1 Uploaded to course website Due next Tuesday, Sep 1, at 11:59pm.
Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101.
THE RELATIONAL MODEL I IST 210: Organization of Data IST210 1.
© 2002 by Prentice Hall 1 The Relational Model David M. Kroenke Database Concepts 1e Chapter 2 2.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Date: 13/03/2015 Training Reference: 2015 GIS_01 Document Reference: 2015GIS_01/PPT/L4 Issue: 2015/L4/1/V1 Addis Ababa, Ethiopia GIS Data Base Management.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Normalization Hour1,2 Presented & Modified by Mahmoud Rafeek Alfarra.
1 6 Concepts of Database Management, 5 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology Spring 2006.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Normalization ACSC 425 Database Management Systems.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
Microsoft Access 1 Database Creation and Management.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
MIDTERM REVIEW IST 210 Organization of Data IST210 1.
Chapter 1. Getting Started IST 210: Organization of Data IST2101.
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.
The Relational Model and Database Normalization
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
A Very Brief Introduction to Relational Databases
Chapter 4 The Relational Model and Normalization
Presentation transcript:

Lab Exercise This Week PHP Basics See last Friday’s slides for requirements Make sure you show the final results to TA to get credit 1IST210

Chapter 2. The Relational Model IST2102

Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational database: – Break a list into several tables, one table for each theme – Tables can be joined together using the value of the data So far, we are pretty vague on what we mean by “table”, “theme” and “value of the data”…… StudentCourse

Chapter 2 Objective Learn the concept of the relational model Learn the meaning and importance of keys, foreign keys, and related terminology Learn the meaning of functional dependencies Learn to apply a process for normalizing relations

Entity An entity is something of importance to a user that needs to be represented in a database An entity represents one theme or topic – An object (e.g., book) with various characteristics (e.g., authors, publisher, ISSN) IST2105

Relation A relation is a two-dimensional table that has specific characteristics The table dimensions, like a matrix, consist of rows and columns IST2106

Characteristics of a Relation Columns contain data about attributes of the entity class – Each column has a unique name – All entries in a column are the same kind Rows contain data about an entity instance – Cells of the table hold a single value – No two rows may be identical The order of the columns is unimportant The order of the rows is unimportant IST2107

Exercise: Relation or Non-Relation? 2-8 EmployeeNumberFirstNameLastName 100MaryAbernathy 101JerryCadley 104AlexCopley 107MeganJackson

Exercise: Relation or Non-Relation? 2-9 EmployeeNumberPhoneLastName , Abernathy Cadley Copley Jackson Cells of the table hold multiple values

Exercise: Relation or Non-Relation? 2-10 EmployeeNumberPhoneLastName Abernathy Cadley Copley Abernathy Jackson No two rows may be identical

Presenting Relation Structure IST210 Column 1 Column 2 …Column n RELATION_NAME(Column1, Column 2, …, Column n) RELATION_NAME 11 STUDENT(StudentID, FirstName, LastName, DOB) STUDENT Original Table Relation Representation From now on, we will frequently use this presentation for relations

Terminology IST210 Synonyms… TableRowColumn FileRecordField RelationTupleAttribute

Key A key is one (or more) columns of a relation that is (are) used to uniquely identify a row – E.g.: OrderID is a key to uniquely identify an order – A composite key is a key that contains two or more attributes E.g.: (BuildingNumber, ApartmentNumber) is a composite key to uniquely identify an apartment IST21013

Example: Key IST21014 What attribute(s) form a key? StudentID: FirstName: (FirstName, LastName): (FirstName, LastName, DOB): (StudentID, FirstName): (StudentID, FirstName, LastName, DOB): yes no yes (in this table), but no (if there are thousands of records, there could be students with same first name and last name) yes (in this table), but no (if more records) yes, but … A key is one (or more) columns of a relation that is (are) used to uniquely identify a row.

Candidate Key IST21015 What attribute(s) form a key? StudentID: FirstName: (FirstName, LastName): (FirstName, LastName, DOB): (StudentID, FirstName): (StudentID, FirstName, LastName, DOB): yes no yes (in this table), but no (if there are thousands of records, there could be students with same first name and last name) yes (in this table), but no (if more records) yes, but A candidate key is called “candidate” because it is a candidate to become the primary key – A special key – If the subset of a key is also a key, we usually don’t consider it as a candidate key not a candidate key, a candidate key

Primary Key A primary key is a candidate key chosen to be the main key for the relation – A relation can only have one primary key – Each candidate key could be chosen as a primary key, but we usually have preferences IST21016 Primary key: StudentID

Primary Key: Discussion IST21017 Even if HomeAddress could be a candidate key, we still prefer choosing StudentID as the primary key. Because (1)HomeAddress might have duplicate (2)HomeAddress is a string, hard to index and query. StudentID is numeric value STUDENT(StudentID, FirstName, LastName, DOB, SSN) SSN: Candidate key? Good to be a primary key? STUDENT(StudentID, FirstName, LastName, DOB, HomeAddress) HomeAddress: Candidate key? Good to be a primary key? Even if SSN is a candidate key, we still prefer choosing StudentID as the primary key. Because SSN is sensitive information

Presenting Primary Key Single Key RELATION_NAME(Column1, Column 2, …, Column n) STUDENT(StudentID, FirstName, LastName, DOB) – The underline of StudentID indicates StudentID is the primary key of this relation Composite Key RELATION_NAME(Column1, Column 2, …, Column n) REGISTRATION(StudentID, CourseID, RegistrationDate) – The underline of StudentID and CourseID indicates (StudentID, CourseID) is the composite primary key of this relation IST21018

How to Choose a Primary Key? IST21019 What if none of existing attributes is appropriate? Answer: artificially create a new attribute Candidate keys: CustomerName? HomeAddress? DOB? Primary key?

A Surrogate Key A Surrogate Key is a unique numeric value that is added to a relation to serve as the primary key – System generated – Contains no semantic meaning Surrogate key is very commonly used. A surrogate key is often used to replace a composite primary key or a non-numeric primary key – (FirstName, LastName, DOB)  StudentID – HomeAddress  CustomerID IST21020

Surrogate Key Examples Penn State database – StudentID Membership database – MembershipID Online shopping – OrderNumber IST21021

Review Key: StudentID, (StudentID, FirstName), … Candidate key: StudentID Primary key: (StudentID, FirstName, LastName, DOB) Surrogate key: StudentID IST21022

True/False Quiz Candidate keys may or may not be unique. The primary key is used to identify unique rows in a relation. Surrogate key values have no meaning to the users. Surrogate key is not primary key. IST21023

True/False Quiz Suppose we have the following table: BOOK(BookID, Title, Publisher, Year) Q1. Title is a key in BOOK? Q2. (BookID, Title) is a key? Q3. (BookID, Title) is a candidate key? Q4. BookID is a surrogate key added to serve as a primary key?