CS405G: Introduction to Database Systems Final Review.

Slides:



Advertisements
Similar presentations
DB glossary (focus on typical SQL RDBMS, not XQuery or SPARQL)
Advertisements

IS698: Database Management Min Song IS NJIT. The Relational Data Model.
Review Indra Budi Fakultas Ilmu Komputer UI 2 Database Introduction Database vs File Processing Main purpose of database Database Actors.
Review for Final Test Indra Budi
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
The Relational Database Model
 CS 405G: Introduction to Database Systems Lecture 7: Relational Algebra II Instructor: Chen Qian Spring 2014.
Midterm Review Lecture 14b. 14 Lectures So Far 1.Introduction 2.The Relational Model 3.Disks and Files 4.Relational Algebra 5.File Org, Indexes 6.Relational.
Relational Databases Relational Model Primary Keys Relation or Relationship Foreign Keys Relationships between entities Integrity Constraints Power of.
CS263 Lecture 19 Query Optimisation.  Motivation for Query Optimisation  Phases of Query Processing  Query Trees  RA Transformation Rules  Heuristic.
Relational Model and Relational Algebra Rose-Hulman Institute of Technology Curt Clifton.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Terms - data,information, file record, table, row, column, transaction, concurrency Concepts - data integrity, data redundancy, Type of databases – single-user,
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Data at the Core of the Enterprise. Objectives  Define of database systems  Introduce data modeling and SQL  Discuss emerging requirements of database.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Database Design & ER Diagrams
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
Midterm 1 Concepts Relational Algebra (DB4) SQL Querying and updating (DB5) Constraints and Triggers (DB11) Unified Modeling Language (DB9) Relational.
The Relational Database Model
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Web-Enabled Decision Support Systems
Introduction to Accounting Information Systems
Software School of Hunan University Database Systems Design Part III Section 5 Design Methodology.
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
CSCE Database Systems Chapter 15: Query Execution 1.
FEN  Concepts and terminology  Operations (relational algebra)  Integrity constraints The relational model.
Instructor: Jinze Liu Fall Basic Components (2) Relational Database Web-Interface Done before mid-term Must-Have Components (2) Security: access.
Relational Data Model Ch. 7.1 – 7.3 John Ortiz Lecture 3Relational Data Model2 Why Study Relational Model?  Most widely used model.  Vendors: IBM,
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
FEN Introduction to the database field:  The Relational Model Seminar: Introduction to relational databases.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
CS 405G: Introduction to Database Systems
 CS 405G: Introduction to Database Systems Lecture 6: Relational Algebra Instructor: Chen Qian.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
CS 405G: Introduction to Database Systems Relational Algebra.
3 1 Database Systems The Relational Database Model.
Logical Database Design and the Relational Model.
Query Processing – Implementing Set Operations and Joins Chap. 19.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu.
Lecture 03 Constraints. Example Schema CONSTRAINTS.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
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.
Module 2: Intro to Relational Model
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
CIS 207 The Relational Database Model
Chapter 4 Relational Databases
Chapter 2: Intro to Relational Model
CS 405G: Introduction to Database Systems
Translation of ER-diagram into Relational Schema
CS 405G: Introduction to Database Systems
CS405G: Introduction to Database Systems
Instructor: Mohamed Eltabakh
The Relational Model Textbook /7/2018.
Chapter 2: Intro to Relational Model
CS 405G: Introduction to Database Systems
Chapter 2: Intro to Relational Model
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
Evaluation of Relational Operations: Other Techniques
Database Dr. Roueida Mohammed.
Presentation transcript:

CS405G: Introduction to Database Systems Final Review

7/2/2015Jinze University of Kentucky2 Database Design

E-R model Entities Attributes Relationships

7/2/2015Jinze University of Kentucky4

7/2/20155 Database Design 57/2/2015

From E-R Diagram to Relations Relations Schemas Converting E-R diagram to relations Keys Super keys Candidate keys Primary keys Relational integrity constraints

Key Constraints Superkey: – (Uniqueness constraints) A set of attributes where no two distinct tuples can have the same values – Every relation has at least one superkey: The set of all attributes. Key: A minimal superkey – Uniqueness constraint (superkey) – Minimum Constraint No attribute can be removed and still satisfy the uniqueness constraints. 7/2/20157Jinze University of Kentucky

7/2/20158 Relational Integrity Constraints Constraints are conditions that must hold on all valid relation instances. There are four main types of constraints: 1.Domain constraints 1.The value of a attribute must come from its domain 2.Key constraints 3.Entity integrity constraints 4.Referential integrity constraints 87/2/2015

Database Normalization Functional Dependency Functional Closure Keys – Redefined – Based on functional dependency DB Norm Form – 1 st, 2 nd, 3 rd, BCNF

7/2/2015Luke Huan Univ. of Kansas10 Database Query

Relational Algebra and SQL Relational algebra SQL query  SFW  Group by …, Having  Subqueries  Relationship between R.A. and SQL

7/2/2015Jinze University of Kentucky12 Relational algebra Core set of operators: – Selection, projection, cross product, union, difference, and renaming Additional, derived operators: – Join, natural join, intersection, etc. Compose operators to make complex queries RelOp A language for querying relational databases based on operators:

7/2/2015Jinze University of Kentucky13 Summary of core operators Selection: Projection: Cross product: Union: Difference: Renaming: – Does not really add “processing” power σp Rσp R πL RπL R R X SR X S R SR S R - S ρ S(A 1, A 2, …) R

7/2/2015Jinze University of Kentucky14 Summary of derived operators Join: Natural join: Intersection: R p S R  SR  S R S

7/2/2015Jinze University of Kentucky15 Classification of relational operators Selection: σ p R Projection: π L R Cross product: R X S Join: R p S Natural join: R  S Union: R U S Difference: R - S Intersection: R ∩ S Monotone Monotone w.r.t. R; non-monotone w.r.t S Monotone

7/2/2015Jinze University of Kentucky16 Update Operations on Relations Update operations – INSERT a tuple. – DELETE a tuple. – MODIFY a tuple. Constraints should not be violated in updates

7/2/2015Luke Huan Univ. of Kansas17 Basic queries: SFW statement SELECT A 1, A 2, …, A n FROM R 1, R 2, …, R m WHERE condition ; Also called an SPJ (select-project-join) query (almost) Equivalent to relational algebra query π A 1, A 2, …, A n (σ condition (R 1 X R 2 X … X R m ))

7/2/2015Luke Huan Univ. of Kansas18 Semantics of SFW SELECT E 1, E 2, …, E n FROM R 1, R 2, …, R m WHERE condition; For each t 1 in R 1 : For each t 2 in R 2 : … … For each t m in R m : If condition is true over t 1, t 2, …, t m : Compute and output E 1, E 2, …, E n as a row t 1, t 2, …, t m are often called tuple variables Not 100% correct, we will see

7/2/2015Jinze University of Kentucky19 Operational semantics of GROUP BY SELECT … FROM … WHERE … GROUP BY … ; Compute FROM Compute WHERE Compute GROUP BY : group rows according to the values of GROUP BY columns Compute SELECT for each group – For aggregation functions with DISTINCT inputs, first eliminate duplicates within the group  Number of groups = number of rows in the final output

7/2/2015Jinze University of Kentucky20 Database Design

21 physical data organization Storage hierarchy (DC vs. Pluto) ! count I/O’s Disk geometry: three components of access cost; random vs. sequential I/O Data layout – Record layout (handling variable-length fields, NULL ’s) – Block layout (NSM, PAX) ! inter-/intra-record locality Access paths – Primary versus secondary indexes – Tree-based indexes: ISAM, B + -tree ! Again, reintroduce redundancy to improve performance ! Fundamental trade-off: query versus update cost

Performance Issues on Indexes Indexes – ISAM – B+ Tree Metrics – Storage – IO-costs Operations – Single value query & range query – Insertion and deletion 22

Query Processing Implementation Typical Query Processings – Selection – Join – Set operations. Typical approaches – Sequential scans in unsorted database – Sorted database – What are the tradeoffs. 23