Relational Data Model Ervi Bongso Alan Fernando CS157A.

Slides:



Advertisements
Similar presentations
Chapter 6 The Relational Algebra
Advertisements

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 6 The Relational Algebra.
พีชคณิตแบบสัมพันธ์ (Relational Algebra) บทที่ 3 อ. ดร. ชุรี เตชะวุฒิ CS (204)321 ระบบฐานข้อมูล 1 (Database System I)
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Relational Algebra Dashiell Fryer. What is Relational Algebra? Relational algebra is a procedural query language. Relational algebra is a procedural query.
The Relational Algebra
Relational Algebra 1 Chapter 5.1 V3.0 Napier University Dr Gordon Russell.
Database Systems Chapter 6 ITM Relational Algebra The basic set of operations for the relational model is the relational algebra. –enable the specification.
Relational Algebra Relational Calculus. Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using.
- relation schema, relations - database schema, database state
Copyright © 2004 Pearson Education, Inc.. Chapter 6 The Relational Algebra and Relational Calculus.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Relational Algebra Archana Gupta CS 157. What is Relational Algebra? Relational Algebra is formal description of how relational database operates. It.
Relational Data Model Sept. 2014Yangjun Chen ACS Outline: Relational Data Model Relational Data Model -relation schema, relations -database schema,
One More Normal Form Consider the dependencies: Product Company Company, State Product Is it in BCNF?
1 The Relational Data Model, Relational Constraints, and The Relational Algebra.
Chapter 3 Section 3.4 Relational Database Operators
Relational Algebra Example Database Application (COMPANY) Relational Algebra –Unary Relational Operations –Relational Algebra Operations From Set Theory.
Final Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
Relational Algebra - Chapter (7th ed )
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 6 The Relational Algebra and Calculus.
CS 380 Introduction to Database Systems Chapter 7: The Relational Algebra and Relational Calculus.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 6 The Relational Algebra.
+ Division Not supported as a primitive operator, but useful for expressing queries like: Find sailors who have reserved all boats. Precondition: in A/B,
Relational Algebra References: Databases Illuminated by Catherine Ricardo, published by Jones and Bartlett in 2004 Fundamentals of Relational Databases.
METU Department of Computer Eng Ceng 302 Introduction to DBMS The Relational Algebra by Pinar Senkul resources: mostly froom Elmasri, Navathe and other.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
Relational Algebra (Chapter 7)
Fundamentals of Database Systems Fourth Edition El Masri & Navathe Instructor: Mr. Ahmed Al Astal Chapter 6 The Relational Algebra University Of Palestine.
Database Concepts. Data :Collection of facts in raw form. Information : Organized and Processed data is information. Database : A Collection of data files.
The Relational Algebra and Calculus
October 9, Announcements Exam Tuesday in class –Closed book Program 2 due Friday –Turn in using D2L dropbox –Only turn in the 4 files specified.
CS424 Relational Data Manipulation Relational Data Manipulation Relational tables are sets. Relational tables are sets. The rows of the tables can be considered.
Chapter 6 The Relational Algebra Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Slide 6- 1 CARTESIAN (or cross) Product Operation Defines a relation Q that is the concatenation of every tuple of relation R with every tuple of relation.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Part a The Relational Algebra and Relational Calculus Hours 1,2.
Al-Maarefa College for Science and Technology INFO 232: Database systems Chapter 3 “part 2” The Relational Algebra and Calculus Instructor Ms. Arwa Binsaleh.
Advanced Relational Algebra & SQL (Part1 )
CpSc 462/662: Database Management Systems (DBMS) (TEXNH Approach) Relational Algebra James Wang.
Presented By: Miss N. Nembhard. Relation Algebra Relational Algebra is : the formal description of how a relational database operates the mathematics.
Presentation by: Tim Sablik.  There are two basic types of operations that will be addressed:  Unary operations are applied to only one relation. 
Dr. Mohamed Hegazi1 The Relational Algebra and Relational Calculus.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 1.
Chapter 6 The Relational Algebra Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Relational Algebra COMP3211 Advanced Databases Nicholas Gibbins
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus تنبيه : شرائح العرض.
Copyright © 2011 Ramez Elmasri and Shamkant Navathe Lecture 8 Relational Algebra April 26, 2015.
Ritu CHaturvedi Some figures are adapted from T. COnnolly
CSE202 Database Management Systems
Database Systems Chapter 6
Chapter (6) The Relational Algebra and Relational Calculus Objectives
The Relational Algebra and Calculus
COMP3017 Advanced Databases
Chapter # 6 The Relational Algebra and Calculus
Fundamental of Database Systems
Relational Algebra at a Glance
Relational Algebra.
Chapter 2: Intro to Relational Model
Theory behind the relational engine
Theory behind the relational engine
Elmasri/Navathe, Fundamentals of Database Systems, 4th Edition
Chapter 4 The Relational Algebra and Calculus
The Relational Algebra and Calculus
Relational Model B.Ramamurthy 5/28/2019 B.Ramamurthy.
Unit Relational Algebra 1
Presentation transcript:

Relational Data Model Ervi Bongso Alan Fernando CS157A

Outline Sect. 6.4, Intro to Relational Algebra Comprise of: Unary Operations:  (selection) and  (projection) Binary Operations:  (union), - (difference),  (intersection), x (cartesian product) Natural Join: * and Join: ⋈ Sect. 6.5, Views and Materialized Views Sect. 6.6, Info of Preservation Issue

Unary:  (selection) Extract a horizontal subset of tuples from a relation that matches specified search criteria. NameAgeWeight Harry3480 Sally2864 George2970 Helena54 Peter3480 NameAgeWeight Harry3480 Helena54 Peter3480  Age≥34 (Person) NameAgeWeight Helena54  Age=Weight (Person) Person

Unary:  (projection) Extract a vertical subset of columns from a relation. NameAgeSalary Harry3480,000 Sally2890,000 George2970,000 Helena5454,280 Peter3440,000 Name Harry Sally George Helena Peter Employee∏ name (Employee)

 (selection),  (projection) Name Sally ∏ name (б Salary>80,000 (Employee)) NameAgeSalary Harry3480,000 Sally2890,000 George2970,000 Helena5454,280 Peter3440,000 Employee

Binary:  (union) Adds the tuples from 1 relation to those from a second relation to produce a third relation. FNLN SusanYao RameshShah BarbaraJones AmyFord JimmyWang FNLN JohnSmith RicardoBrown SusanYao FrancisJohnson RameshShah StudentProfessor FNLN SusanYao RameshShah BarbaraJones AmyFord JimmyWang JohnSmith RicardoBrown FrancisJohnson Student  Professor

Binary: - (difference) Contains the tuples from the first relation that are not in the second relation. FNLN SusanYao RameshShah BarbaraJones AmyFord JimmyWang FNLN JohnSmith RicardoBrown SusanYao FrancisJohnson RameshShah StudentProfessor FNLN BarbaraJones AmyFord JimmyWang Student - Professor Professor - Student FNLN JohnSmith RicardoBrown FrancisJohnson

Binary:  (intersection) Contains tuples common to the two relations. FNLN SusanYao RameshShah BarbaraJones AmyFord JimmyWang FNLN JohnSmith RicardoBrown SusanYao FrancisJohnson RameshShah StudentProfessor FNLN SusanYao RameshShah Student  Professor

Binary: x (cartesian product) Does not have to be union compatible. Produces a new element by combining every tuple from one set with every tuple from the other set. R×S = R(A1,A2,...,An) × S(B1,B2,...Bm) = Q(A1,A2,...,An,B1,B2,...Bm) with degree n + m attributes

Join: ⋈ Used to combine related tuples from two relations into single tuples. Allows us to process relationships among relations. Example: to retrieve the name of the manager of each department: Step1) Dept_mgr ← Dept ⋈ Mgr_Ssn=SsnEmployee Step2) Result ← πDname, Lname, Fnamer(Dept_mgr)

Example  Join: ⋈ EMPLOYEE FnameMinitLnameSsn JohnBSmith1.23E+08 FranklinTWong3.33E+08 AliciaJZelaya1E+09 JenniferSWallace9.88E+08 RameshKNarayan6.67E+08 JoyceAEnglish4.53E+08 AhmadVJabbar9.88E+08 JamesEBorg8.89E+08 DEPARTMENT DnameDnumberMgr_ssn Research53.33E+08 Administration49.88E+08 Headquarters18.89E+08 DEPT_MGR DnameDnumb er Mgr_SSN...FnameMinitLnameSSN Research53.33E+08...FranklinTWong3.33E+08 Administratn49.88E+08...JenniferSWallace9.88E+08 Headquarters18.89E+08...JamesEBorg8.89E+08

Natural Join: * Created to get rid of the second attribute. Requires that the two join attributes have the same name. If not, renaming must first be applied. Example: DEPT_LOCS ← DEPARTMENT * DEPT_LOCATIONS

Example  Natural Join: * DEPARTMENT DnameDnumberMgr_ssn Research53.33E+08 Administration49.88E+08 Headquarters18.89E+08 DEPT_LOCATIONS DnumberDlocation 1Houston 4Stafford 5Bellaire 5Sugarland 5Houston DEPT_LOCS DnameDnumberMgr_ssnDlocation Headquarters18.89E+08Houston Administration49.88E+08Stafford Research53.33E+08Bellaire Research53.33E+08Sugarland Research53.33E+08Houston

Views and Materialized Views Views Allows the same data to be seen by different users in different ways at the same time. Provides security Hides data complexity from the user. Growth and Restructuring Growth is expansion of existing relation schema. Restructuring is changes other than growth.

Materialized Views (Snapshot) Stored in the database. Refreshed when updates occur. Used to freeze data. Deleted when it is not used for a period of time. Views and Materialized Views (cont.)

Issue of Info Reservation

References Elamstri and Navathe, Fundamentals of Database Systems, 5th ed., Addison-Wesley, 2008 Umanath and Scamell, Data Modeling and Database Design, Thomson /cs157a.html

Thank You!