2012 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) n- 항 관계 (n-ary Relations)

Slides:



Advertisements
Similar presentations
CSE 211- Discrete Structures
Advertisements

이산수학(Discrete Mathematics)
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.
Oct 28, 2003Murali Mani Relational Algebra B term 2004: lecture 10, 11.
1 Relations Rosen 5 th ed., ch Relations Relationships between elements of sets occur very often.Relationships between elements of sets occur very.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Relations.
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 집합과 연산 (Sets and Operations)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 8: Relations Relations(8.1) n-any Relations &
1 The Relational Data Model, Relational Constraints, and The Relational Algebra.
(CSC 102) Lecture 15 Discrete Structures. Previous Lectures Summary  Procedural Versions  Properties of Sets  Empty Set Properties  Difference Properties.
8.2 n-ary Relations and Their Applications
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 행렬 (Matrices)
Module #18: Relations, part I
Relations Rosen 5 th ed., ch. 7. Binary Relations Let A, B be any sets. A binary relation R from A to B, written (with signature) R:A×B, or R:A,B, is.
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 재귀 호출 (Recursion)
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 귀납과 재귀 (Induction and Recursion)
Discrete Maths Objective to introduce relations, show their connection to sets, and their use in databases , Semester 2, Relations.
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  정수와 나눗셈 (The Integers and Division)
Relations and Their Properties
Chapter 6 Relations Relationships are dealed with every day: businesses and their telephone numbers, employees and their salaries, …. Relationships can.
Functions1 Elementary Discrete Mathematics Jim Skon.
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  함수 (Functions)
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Chapter 5 – Relations and Functions. 5.1Cartesian Products and Relations Definition 5.1: For sets A, B  U, the Cartesian product, or cross product, of.
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Chapter 7: Relations Relations(7.1) Relations(7.1) n-any Relations & their Applications (7.2) n-any Relations & their Applications (7.2)
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 관계와 표현 (Relations and Representation)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Discrete Mathematics Relation.
Relations and their Properties
Advanced Relational Algebra & SQL (Part1 )
2014 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  집합 (Set)
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
2014 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  집합 연산 (Set Operations)
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
이산수학 (Discrete Mathematics) 7.3 관계의 표현 (Representing Relations) 2006 년 봄학기 문양세 강원대학교 컴퓨터과학과.
Lecture on Relations 1Developed by CSE Dept., CIST Bhopal.
Discrete Structures – CNS2300
Problem Statement How do we represent relationship between two related elements ?
2014 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
Functions (Mappings). Definitions A function (or mapping)  from a set A to a set B is a rule that assigns to each element a of A exactly one element.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
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) 수학적 귀납법 (Mathematical Induction)
Theory of Computing Topics Formal languages automata computability and related matters Purposes To know the foundations and principles of computer science.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Relational Algebra COMP3211 Advanced Databases Nicholas Gibbins
15.1 CompSci 102© Michael Frank Today’s topics RelationsRelations –Kinds of relations –n-ary relations –Representations of relations Reading: Sections.
Applied Discrete Mathematics Week 10: Relations
CSE15 Discrete Mathematics 02/15/17
Relations Rosen 5th ed., ch. 7.
CSE 504 Discrete Structures & Foundations of Computer Science
CMSC Discrete Structures
Discrete Structures for Computer Science
CS2210 Discrete Structures Relations
Rosen 5th ed., ch. 7 ~32 slides (in progress), ~2 lectures
Discrete Math (2) Haiming Chen Associate Professor, PhD
CSE 321 Discrete Structures
Applied Discrete Mathematics Week 6: Relations/Digraphs
Relations and their Properties
2/18/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
2/25/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
Discrete Math (2) Haiming Chen Associate Professor, PhD
7/30/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
Presentation transcript:

2012 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) n- 항 관계 (n-ary Relations)

Discrete Mathematics by Yang-Sae Moon Page 2 n-ary Relations (n- 항 관계 ) An n-ary relation R on sets A 1,…,A n, written R:A 1,…,A n, is a subset R  A 1 × … × A n. (A 1,…,A n 에 대한 n- 항 관계 R 은 A 1 × … × A n 의 부분집합이다.) The sets A i are called the domains of R. (A i 를 R 의 정의역이라 한다.) The degree of R is n. ( 관계 R 의 차수는 n 이다.) 7.2 n-ary Relations

Discrete Mathematics by Yang-Sae Moon Page 3 Relational Databases ( 관계형 DB) A relational database is essentially an n-ary relation R. ( 관계형 데이터베이스란 n- 항 관계 R 을 의미한다.) A domain A i is a primary key for the database if the relation R contains at most one n-tuple (…, a i, …) for any value a i within A i. ( 만일 R 이 ( 정의역 A i 에 포함된 ) a i 에 대해서 기껏해야 하나의 n- 항 튜플 (…, a i, …) 를 포함하면, A i 는 기본 키라 한다.) ( 다시 말해서, a i 값을 가지는 n- 항 튜플이 유일하면 A i 를 키본 키라 한다.) A composite key for the database is a set of domains {A i, A j, …} such that R contains at most 1 n-tuple (…,a i,…,a j,…) for each composite value (a i, a j,…)  A i ×A j ×… 7.2 n-ary Relations

Discrete Mathematics by Yang-Sae Moon Page 4 Primary Key 예제 예제 : ( 새로운 튜플이 추가되지 않는다고 할 때,) 다음 테이블에서 어떤 정의역이 기본 키인가 ? 7.2 n-ary Relations Student_nameID_numberMajorGPA Ackermann Computer Science3.88 Adams Physics3.45 Chou Computer Science3.49 Goodfriend Mathematics3.45 Rao Mathematics3.90 Stevens Psychology2.99 Student_name 은 키본 키이다. ( 유일하게 구분 짓는다.) 마찬가지로, ID_number 또한 기본 키이다. 반면에, Major 나 GPA 는 기본 키가 아니다.

Discrete Mathematics by Yang-Sae Moon Page 5 Composite Key 예제 예제 : ( 새로운 튜플이 추가되지 않는다고 할 때,) 다음 테이블에서 {Major, GPA} 는 합성 키인가 ? 7.2 n-ary Relations Student_nameID_numberMajorGPA Ackermann Computer Science3.88 Adams Physics3.45 Chou Computer Science3.49 Goodfriend Mathematics3.45 Rao Mathematics3.90 Stevens Psychology2.99 Major 와 GPA 를 조합하여 사용하면 튜플을 유일하게 구분 지을 수 있으므로, {Major, GPA} 는 상기 테이블의 합성 키이다.

Discrete Mathematics by Yang-Sae Moon Page 6 Selection Operator (  ) Let A be any n-ary domain A=A 1 ×…×A n, and let P:A → {T,F} be any predicate on elements of A. (A 를 n- 항 관계의 정의역이라 하고, P 를 A 에서 {T,F} 로의 술어라 하자.) Then, the selection operator  p is the operator that maps any (n-ary) relation R on A to the n-ary relation of all n- tuples from R that satisfy P. ( 셀렉션 연산자  p 은 관계 R 의 n- 튜플 중에서 술어 P 를 만족하는 튜플들의 관계 로 정의한다.) I.e.,  R  A,  p (R) = R  {a  A | P(a) = T} 7.2 n-ary Relations

Discrete Mathematics by Yang-Sae Moon Page 7 Selection Example Suppose we have a domain A = StudentName × Level × SocSecNos Suppose we define a certain predicate on A, UpperLevel(name, level, ssn) : ≡ [(level = junior)  (level = senior)] Then,  UpperLevel is the selection operator that takes any relation R on A (database of students) and produces a relation consisting of just the upper-level classes (juniors and seniors). That is,  (level = junior)  (level = senior) (R) 7.2 n-ary Relations Student_nameID_numberMajorGPA Ackermann Computer Science3.88 Adams Physics3.45 Chou Computer Science3.49 Goodfriend Mathematics3.45 Rao Mathematics3.90 Stevens Psychology2.99

Discrete Mathematics by Yang-Sae Moon Page 8 Projection Operator (  ) Let A = A 1 ×…×A n be any n-ary domain, and let {i k }=(i 1,…,i m ) be a sequence of indexes, That is, where 1 ≤ i k ≤ n for all 1 ≤ k ≤ m. Then the projection operator  on n-tuples is defined by: 7.2 n-ary Relations Student_nameID_numberMajorGPA Ackermann Computer Science3.88 Adams Physics3.45 Chou Computer Science3.49 Goodfriend Mathematics3.45 Rao Mathematics3.90 Stevens Psychology2.99

Discrete Mathematics by Yang-Sae Moon Page 9 Projection Example Suppose we have a ternary (3-ary) domain Cars = Model×Year×Color. (note n=3). Consider the index sequence {i k }= 1,3. (m=2) Then the projection  simply maps each tuple (a 1,a 2,a 3 ) = (model,year,color) to its image: 7.2 n-ary Relations Student_nameID_numberMajorGPA Ackermann Computer Science3.88 Adams Physics3.45 Chou Computer Science3.49 Goodfriend Mathematics3.45 Rao Mathematics3.90 Stevens Psychology2.99

Discrete Mathematics by Yang-Sae Moon Page 10 (Natural) Join Operator ( ) Puts two relations together to form a sort of combined relation. ( 관계를 합성하는 한 가지 방법 ) If the tuple (A,B) appears in R 1, and the tuple (B,C) appears in R 2, then the tuple (A,B,C) appears in the join R 1 R 2. A, B, C can also be sequences of elements rather than single elements. 7.2 n-ary Relations

Discrete Mathematics by Yang-Sae Moon Page 11 (Natural) Join Example Suppose R 1 is a teaching assignment table, relating Professors to Courses. ((Professor, Courses) 로 구성된 관계 ) Suppose R 2 is a room assignment table relating Courses to Rooms,Times. ((Courses, Rooms, Times) 로 구성된 관계 ) Then R 1 R 2 is like your class schedule, listing (professor,course,room,time). 7.2 n-ary Relations