Relational Database Model & Database Development Process IST359 M005 Yang Wang 342 Hinds

Slides:



Advertisements
Similar presentations
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Advertisements

Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
The Database Environment IST359 M005 Yang Wang 342 Hinds
IST359 M005 Yang Wang 342 Hinds SQL Programming And The External Model.
The Relational Database Model
THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS Fact of the Week: According to a Gartner study in ‘06, Microsoft SQL server had the highest.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
ETEC 100 Information Technology
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Structured Query Language SQL IST359 M005 Yang Wang 342 Hinds
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
IST Databases and DBMSs Todd S. Bacastow January 2005.
CS 380 Introduction to Database Systems (Chapter 5: The Relational Data Model and Relational Database Constraints)
The Relational Database Model
Chapter 3 Relational Model Chapter 4 in Textbook.
3 The Relational Model MIS 304 Winter Class Objectives That the relational database model takes a logical view of data That the relational model’s.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
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
RAJIKA TANDON DATABASES CSE 781 – Database Management Systems Instructor: Dr. A. Goel.
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Chapter 3 The Relational Model. 2 Chapter 3 - Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between.
10/17/2012ISC471/HCI571 Isabelle Bichindaritz 1 Technologies Databases.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
M1G Introduction to Database Development 2. Creating a Database.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Relational Database. Database Management System (DBMS)
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems.
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.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 3 The Relational Database Model.
1 CS 430 Database Theory Winter 2005 Lecture 4: Relational Model.
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
The Relational Database Model & The Database Development Process
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
SQL Select Statement IST359 M005 Yang Wang 342 Hinds
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.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming Data Models into Database.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
Chapter 4 The Relational Model Pearson Education © 2009.
Database Planning Database Design Normalization.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1 Agenda TMA02 M876 Block 4. 2 Model of database development data requirements conceptual data model logical schema schema and database establishing requirements.
Standards and Conventions
Databases and DBMSs Todd S. Bacastow January
Databases Chapter 9 Asfia Rahman.
Database Systems: Design, Implementation, and Management Tenth Edition
Lecture 2 The Relational Model
Translation of ER-diagram into Relational Schema
Database Design: Relational Model
Presentation transcript:

Relational Database Model & Database Development Process IST359 M005 Yang Wang 342 Hinds

Acknowledgements and caveat These slides draw liberally, with permission, from the following sources: IST359 materials by Prof. Michael Fudge Jr. Caveat (beware): At best, PowerPoint slides are only a pale limitation of the entirety of a class meeting. In IST359 in particular, the lectures will cover topics beyond what appears in these slides. Don’t rely on them as a substitute for attending class.

Learning Objectives Describe the Relational Model Define relational terms and understand the terminology in practice Understand these relational terms through practice Explain the System Development Life Cycle Explain the Database Life Cycle

Learning Objectives Describe the Relational Model Define relational terms and understand the terminology in practice Understand these relational terms through practice Explain the System Development Life Cycle Explain the Database Life Cycle

The Relational Database Model  Many DBMS products implement the Relational Model, but none of them enforce it. This permits rookie database designers to shoot themselves in the foot. And many have (including yours truly).  The Relational Model has: (Codd’s 3 rules)  1)Data Independence  Clear separation between data and metadata  2) Data Consistency  Minimal redundancy; the data adopts the “DRY” principle  3) Easy to use - abstracted  You don’t have to understand the implementation to use it.

You too can make a crappy DB like this one! Do you see problems with this database design? Think Codd: Independence? Consistency? Ease-of-Use? Change Sally Jones’s phone #? Add New Employee Bob Smith?

Activity: Relational Terminology Identify each of these : Table Relation Row Column Tuple Attribute Atomic (Attrib.) Logical Domain Physical Domain

Tables are “Buckets for your data” Customers Orders Products “Customers Place Orders” “Products Appear on Orders” Tables: Specialized Order doesn’t matter Contain real items Relationships among tables: Enforce business rules Apply to real items

What makes a table a relation? A column or a set of columns uniquely identify each row

DBMS : Physical Domain SQL ServerMySQLWhat Is It? int Signed Integer values -2G  +2G int identityserial Auto-incrementing integer (surrogate keys) bit Used for true / false yes/no values. decimal(n,d) A fixed-point signed decimal of n digits with d decimal places. char(n) Exactly n characters, useful for fixed-length data. varchar(n) Variable length of no more than n characters. text Variable length of 2G characters; not index able datetime For storing dates and or times. Notes: Different “flavors” of DBMSs use different data types. It’s not part of the SQL Spec, but part of the DBMS implementation.

DBMS: Logical Domain / Constraints Default Value – a value entered into an attribute for a row when one isn’t specified. Check Constraint – an expression which must be evaluated prior to the insertion of a row. E.g., employee_hourly_wage >= 0 Unique Constraint – ensures duplicate values are not inserted into a column. Lookup table – a separate table containing all of the acceptable values for a given column.

Keys Candidate Key – any attribute or combination of attributes that can uniquely identify each row Primary Key - A candidate key which has been chosen by the database designer to uniquely identify each Surrogate Key - A primary key whose values are automatically generated by the DBMS Secondary Key - An attribute or combination of attributes used for row retrieval from a table. In practice, secondary keys are index candidates in the table design. Foreign Key – an attribute or combination of attributes in one table whose values either match those of the primary key in another table or are null. Used to link relations.

Activity: The Relational Table Relation Name? Attributes? Logical Domain of Columns? Physical Domain of Columns? Candidate keys? NameTeamTotal YdsTDs Emmitt SmithCowboys Walter PaytonBears Barry SandersLions Emmitt SmithCardinals9379

The Primary Key Constraint Special selected constraint (you choose it) Enforces entity integrity on the table. Must be data unique for each row Should be a candidate key

Good PK … Bad PK Good candidate key choices? Customer Name? Address? Name and DOB? SSN? Customer Selected value? Random Unique #? Sequential Unique #? Last two are examples of surrogate keys The best PK’s – Don’t change … ever! – Have no external meaning – Do not compromise security… – Do not hinder performance …

Activity: Which of these is a good PK? Candidate keys? Best primary key? Why? Should a Surrogate key be used?

The Foreign Key constraint The foreign key is a constraint on a column of one relation so that it can be associated with another relation. Foreign keys must have referential integrity – their values must come from the corresponding Primary Key column in the relation.

Example of FK: The Lookup Table CategoryID Book Hardware Software Foreign Key

Activity: Find the keys Candidate? Primary? Foreign? Secondary? Surrogate?

One more time. Rule for joining tables Tables Columns: Physical Domain? Logical Domain? Allow Null? Keys: Candidate? Primary? Foreign, Surrogate, Secondary?

The Equi-Join of PK-FK at Work Equi Join

Activity: Where’s the Integrity? Which of the 4 tables exhibit Entity Integrity? Which of the 3 relationships exhibit Referential Integrity?

FK Example: Implementation of a 1-M Relationship

FK Example: Implementation of a M-N Relationship This M-M Relationship has been resolved into two 1-M relationships

Example:Null and Flags Null makes sense for this column 103 and 105 are null for different reasons! Flags used to represent different status Nulls typically cause problems in Varchar and Numeric, and bit fields

Data Models: Abstraction Levels Conceptual Internal External Physical Logical Highly Abstract Hardware and Software Independent Somewhat Abstract Hardware Independent Software Dependent Not Abstract (Concrete) Hardware and Software Dependent

An Concrete Example SU administration asks us to build a database for class enrollment o E.g., student info, class info, a student enrolls in a class Logical model: what database model to use? Relational, object- oriented, object-relational, etc. o E.g., we use relational model (entities, relations). Internal model: use a DBMS to implement our relational model o E.g., what do the student, class tables look like? External model: what the internal model looks like to end users (hide details of the implementation, e.g., tables) o E.g., you can see a student enrolls in a class Physical model: how database is implemented by the DBMS o E.g., how is the database physically stored? In a single file? Conceptual model: represent requirements, what needs to be represent in the database?

Systems Development Lifecycle I Planning II Analysis III Design IV Implementation V Maintenance & Support Time Resources Conceptual Model Logical Model Internal / External Model SDLC / DBLC Physical Model

Alternatives Fast prototyping Agile development eXtreme programming Hackathon

Exercise Design a database for on-campus parking info – Car – Parking lots – A parking permit allows a car to park in a certain parking lot Tables and keys

Permit_IDSUIDCar LicenseLot numPrice Permits (table) SUIDLast nameFirst nameGenderSchool Persons (table) Car LicenseBrandModelColor Cars (table)