8.2 n-ary Relations and Their Applications

Slides:



Advertisements
Similar presentations
CSE 211- Discrete Structures
Advertisements

DATA MODELS A collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints. Provide a way to describe.
The Hierarchical Model
Chapter 3 : Relational Model
5/16/20151 You Never Escape Your… Relations. 5/16/20152Relations If we want to describe a relationship between elements of two sets A and B, we can use.
CS2210(22C:19) Discrete Structures Relations Spring 2015 Sukumar Ghosh.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Database Design & ER Diagrams
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 8: Relations Relations(8.1) n-any Relations &
Concepts of Database Management, Fifth Edition
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
(CSC 102) Lecture 15 Discrete Structures. Previous Lectures Summary  Procedural Versions  Properties of Sets  Empty Set Properties  Difference Properties.
Chapter Relations and Their Properties 8.2 n-ary Relations and Their Applications 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.
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 /
Relational Data Model. A Brief History of Data Models  1950s file systems, punched cards  1960s hierarchical  IMS  1970s network  CODASYL, IDMS 
Chapter One (Introduction) Objectives Introduction to Database Management Systems (DBMS) Relational Databases Model Restrictions of RD Database Life Cycle.
THE RELATIONAL DATA MODEL CHAPTER 3 (6/E) CHAPTER 5 (5/E) 1.
CS 3630 Database Design and Implementation. 2 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An.
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
10/9/20151 The Relational Data Model TCU Database Systems Last update: September 2004 Reference: Elmasri 4 th edition, chapter 5.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
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.
Discrete Maths Objective to introduce relations, show their connection to sets, and their use in databases , Semester 2, Relations.
Relational Databases (MS Access)
Relations and Their Properties
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – Relational Model.
Chapter 6 Relations Relationships are dealed with every day: businesses and their telephone numbers, employees and their salaries, …. Relationships can.
CIS552Relational Model1 Structure of Relational Database Relational Algebra Extended Relational-Algebra-Operations Modification of the Database.
1 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An = {(x1, x2, x3, …, xn): xi  Ai} R  A1  A2.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
DATABASE SYSTEMS. DATABASE u A filing system for holding data u Contains a set of similar files –Each file contains similar records Each record contains.
Discrete Structures1 You Never Escape Your… Relations.
What have we learned?. What is a database? An organized collection of related data.
Chapter 7: Relations Relations(7.1) Relations(7.1) n-any Relations & their Applications (7.2) n-any Relations & their Applications (7.2)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Discrete Mathematics Relation.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Relations and their Properties
Announcements Reading for Monday –4.6 Homework 3 – Due 9/29.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Introduction.
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
Lecture on Relations 1Developed by CSE Dept., CIST Bhopal.
Discrete Structures – CNS2300
N-ary Relations & Their Applications. 2 n-ary Relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 x A 2 x … x A.
2012 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) n- 항 관계 (n-ary Relations)
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 71 The Relational Data Model, Relational Constraints & The Relational Algebra.
Applied Discrete Mathematics Week 10: Relations
CSE 504 Discrete Structures & Foundations of Computer Science
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 9 Relations Slides are adopted from.
Chapter 2: Intro to Relational Model
CS2210 Discrete Structures Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Applied Discrete Mathematics Week 6: Relations/Digraphs
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Presentation transcript:

8.2 n-ary Relations and Their Applications Definition 1: Let A1, A2, . . ., An be sets. An n-ary relation on these sets is a subset of A1 A2 . . .  An The sets A1, A2, . . ., An are called the domains of the relation, and n is called its degree. Example 4: Let R be the relation consisting of 5-ruples (A, N, S, D, T) representing airplane flights, where A is the airline, N is the starting point, D is the destination, and T is the departure time, for instance, if Nadir Express Airlines has flight 963 from Newark to Bangor at 15:00, then (Nadir, 963, Newark, Bangor, 15:00) belongs to R, the degree of this relation is 5, and its domains are the set of all airlines, the set of flight numbers, the set of cities, the set of cities(again) , and the set of times.

Databases and Relations The time required to manipulate information in a database depends on how this information is stored. The operations of adding and deleting records, updating records, searching for records, and combining records from overlapping databases are performed millions of times each day in a large database. Because of the importance of these operations, various methods for representing databases have been developed. We will discuss one of these methods, called the relational data model, based on the concept of a relation.

Databases and Relations A database consists of records, which are n-tuples, made up of fields. For instance, a database of student records may be made up of fields containing the name, student number, major, and grade point average of the student. Thus , student records are represented as 4-tuples of the form (STUDENT NAME, ID NUMBER, MAJOR, GPA). A sample database of six such records is (Ackermann, 231455, Computer Science, 3.88) (Adams, 888323, physics, 3.45) (Chou, 102147, Computer Science, 3.49) (Goodfriend, 453876, Mathematics, 3.45) (Rao, 678543, Mathematics, 3.90) (Stevens, 786576, Psychology, 2.99)

Databases and Relations Relations used to represent databases are also called tables. A domain of an n-ary relation is called a primary key when the value of the n-tuple from this domain determines the n-tuple. The current collection of n-tuples in a relation is called the extension of the relation. The more permanent part of a database , including the name and attributes of the database, is called its intension.

Databases and Relations

Databases and Relations Example 5: which domains are primary keys for the n-ary relation displayed in Table1, assuming that no n-tuples will be added in the future? Combinations of domains can also uniquely identify n-tuples in an n-ary relation. When the values of a set of domains determine an n-tuple in a relation, the Cartesian product of these domains is called a composite key. Example 6: Is the Cartesian product of the domain of major fields of study and the domain of GPAs a composite key for the n-ary relation from Table1, assuming that no n-tuples are ever added?

Operations on n-ary Relations Definition 2: Let R be an n-ary relation and C a condition that elements in R may satisfy. Then the selection operator sC maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy the condition C. Example 7: To find the records of computer science majors in the n-ary relation R shown in Table 1, we use the operator sC1, C1 is the condition Major =“ Computer Science.” To find the records of students who have a grade point average above 3.5 in this database, we use the operator sC2, where C2 is the condition GPA > 3.5. To find the records of computer science majors who have a GPA above 3.5, we use the operator sC3 , C3 is the condition (Major=“Computer Science” Λ GPA > 3.5 ).

Operations on n-ary Relations Definition 3: The projection, Pi1, Pi2,. . . , Pim where i1 < i2 <. . .< im , maps the n-tuple (a1, a2,. . ., an) to the m-tuple (ai1 , ai2 , . . ., aim ) , m  n. Example 8: what results then the projection P1,3 is applied to the 4-tuples (2, 3, 0, 4), (Jane Doe, 234111001, Geography, 3.14), and (a1, a2, a3, a4)? Example 9: What relation results when the projection P1,4 is applied to the relation in Table 1?