Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.

Slides:



Advertisements
Similar presentations
Lecture 1 RMIT University, Taylor's University Learning Objectives
Advertisements

Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Database Systems.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
2.1 Sets. DEFINITION 1 A set is an unordered collection of objects. DEFINITION 2 The objects in a set are called the elements, or members, of the set.
Denoting the beginning
Sets 1.
Sets 1.
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Survey of Mathematical Ideas Math 100 Chapter 2
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
CS355 - Theory of Computation Lecture 2: Mathematical Preliminaries.
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Set Theory. What is a set?  Sets are used to define the concepts of relations and functions. The study of geometry, sequences, probability, etc. requires.
Database System Concepts, 5 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Relational.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 6 – September 6 th, 2001.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – Relational Model.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
ICOM 5016 – Introduction to Database Systems Lecture 5b Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Sets Defined A set is an object defined as a collection of other distinct objects, known as elements of the set The elements of a set can be anything:
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Chapter 2: The Basic Concepts of Set Theory. Sets A set is a collection of distinguishable objects (called elements) Can define in words Can list elements.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 9 – September 18, 2001.
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
Discrete Structure Sets. 2 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element.
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Mathematical Proofs. Chapter 1 Sets 1.1 Describing a Set 1.2 Subsets 1.3 Set Operations 1.4 Indexed Collections of Sets 1.5 Partitions of Sets.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
CompSci 102 Discrete Math for Computer Science
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Introduction.
ELEMENTARY SET THEORY.
Set theory Neha Barve Lecturer Bioinformatics
Module Code MA1032N: Logic Lecture for Week Autumn.
Chapter 2 With Question/Answer Animations. Section 2.1.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
Basic Definitions of Set Theory Lecture 23 Section 5.1 Wed, Mar 8, 2006.
ICOM 5016 – Introduction to Database Systems Lecture 6 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Discrete Mathematics Set.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Basic Definitions of Set Theory Lecture 23 Section 5.1 Mon, Feb 21, 2005.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Notions & Notations (2) - 1ICOM 4075 (Spring 2010) UPRM Department of Electrical and Computer Engineering University of Puerto Rico at Mayagüez Spring.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
2004/10/5fuzzy set theory chap03.ppt1 Classical Set Theory.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
The Basic Concepts of Set Theory. Chapter 1 Set Operations and Cartesian Products.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
“It is impossible to define every concept.” For example a “set” can not be defined. But Here are a list of things we shall simply assume about sets. A.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.
Set Definition: A set is unordered collection of objects.
CSNB 143 Discrete Mathematical Structures
Set, Combinatorics, Probability & Number Theory
Sets Section 2.1.
CS 2210:0001 Discrete Structures Sets and Functions
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CS100: Discrete structures
2.1 Sets Dr. Halimah Alshehri.
Discrete Mathematics CS 2610
Terms Set S Set membership x  S Cardinality | S |
ICOM 5016 – Introduction to Database Systems
Lecture Sets 2.2 Set Operations.
ICOM 5016 – Introduction to Database Systems
Presentation transcript:

Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction to Database Systems Lecture 2 – Sets and Relations Dr. Manuel Rodriguez Martinez and Dr. Bienvenido Vélez Department of Electrical and Computer Engineering University of Puerto Rico, Mayagüez Slides are adapted from:

©Silberschatz, Korth and Sudarshan1.2Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Objectives Introduce Set Theory Review of Set concepts Cardinality Set notation Empty set Subset Set Operations Union Intersection Difference Complex Sets Power Sets Partitions Relations Cartesian products Binary relations N-ary relations

©Silberschatz, Korth and Sudarshan1.3Database System Concepts, 5 th Ed., slide version 5.0, June 2005 On Sets and Relations A set S is a collection of objects, where there are no duplicates Examples  A = {a, b, c}  B = {0, 2, 4, 6, 8}  C = {Jose, Pedro, Ana, Luis} The objects that are part of a set S are called the elements of the set. Notation:  0 is an element of set B is written as 0  B.  3 is not an element of set B is written as 3  B.

©Silberschatz, Korth and Sudarshan1.4Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Cardinality of Sets Sets might have 0 elements – called the empty set . 1 element – called a singleton N elements – a set of N elements (called a finite set)  Ex: S = {car, plane, bike}  elements – an infinite number of elements (called infinite set)  Integers, Reals,  Even numbers: E = {0, 2, 4, 6, 8, 10, …} –Dot notation means infinite number of elements

©Silberschatz, Korth and Sudarshan1.5Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Cardinality of Sets (cont.) The cardinality of a set is its number of elements Notation: cardinality of S is denoted by |S| Could be:  an integer number  infinity symbol . Countable Set - a set whose cardinality is: Finite Infinite but as big as the set of natural numbers (one-to-one correspondence) Uncountable set – a set whose cardinality is larger than that of natural numbers. Ex: R - real numbers

©Silberschatz, Korth and Sudarshan1.6Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Cardinality of Sets (cont.) Some examples: A = {a,b,c}, |A| = 3 N = {0,1,2,3,4,5,…}  |N| =  R – set of real numbers  |R| =  E = {0, 2, 3, 4, 6, 8, 10, …}  |E| =   the empty set  |  | = 0

©Silberschatz, Korth and Sudarshan1.7Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Set notations and equality of Sets Enumeration of elements of set S A = {a,b c} E = {0, 2, 4, 6, 8, 10, …} Enumeration of the properties of the elements in S E = {x : x is an even integer} E = {x: x  I and x%2=0, where I is the integers.} Two sets are said to be equal if and if only they both have the same elements A = {a, b, c}, B = {a, b, c}, then A = B if C = {a, b, c, d}, then A  C  Because d  A

©Silberschatz, Korth and Sudarshan1.8Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Sets and Subsets Let A and B be two sets. B is said to be a subset of A if and only if every member x of B is also a member of A Notation: B  A Examples:  A = {1, 2, 3, 4, 5, 6}, B = {1, 2}, then B  A  D = {a, e, i, o, u}, F = {a, e, i, o, u}, then F  D If B is a subset of A, and B  A, then we call B a proper subset  Notation: B  A  A = {1, 2, 3, 4, 5, 6}, B = {1, 2}, then B  A The empty set  is a subset of every set, including itself    A, for every set A If B is not a subset of A, then we write B  A

©Silberschatz, Korth and Sudarshan1.9Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Set Union Let A and B be two sets. Then, the union of A and B, denoted by A  B is the set of all elements x such that either x  A or x  B. A  B = {x: x  A or x  B} Examples: A = {10, 20, 30, 40, 100}, B = {1,2, 10, 20} then A  B = {1, 2, 10, 20, 30, 40, 100} C = {Tom, Bob, Pete}, then C   = C For every set A, A  A = A (Idempotence Law)

©Silberschatz, Korth and Sudarshan1.10Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Set Intersection Let A and B be two sets. Then, the intersection of A and B, denoted by A  B is the set of all elements x such that x  A and x  B. A  B = {x: x  A and x  B} Examples: A = {10, 20, 30, 40, 100}, B = {1,2, 10, 20} then A  B = {10, 20} Y = {red, blue, green, black}, X = {black, white}, then Y  X = {black} E = {1, 2, 3}, M={a, b} then, E  M =  C = {Tom, Bob, Pete}, then C   =  For every set A, A  A = A (Idempotence Law) Sets A and B disjoint if and only if A  B =  They have nothing in common

©Silberschatz, Korth and Sudarshan1.11Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Set Difference Let A and B be two sets. Then, the difference between A and B, denoted by A - B is the set of all elements x such that x  A and x  B. A - B = {x: x  A and x  B} Examples: A = {10, 20, 30, 40, 100}, B = {1,2, 10, 20} then A - B = {30, 40, 100} Y = {red, blue, green, black}, X = {black, white}, then Y - X = {red, blue, green} E = {1, 2, 3}, M={a, b} then, E - M = E C = {Tom, Bob, Pete}, then C -  = C For every set A, A - A = 

©Silberschatz, Korth and Sudarshan1.12Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Power Set and Partitions Power Set: Given a set A, then the set of all possible subsets of A is called the power set of A. Notation: Example:  A = {a, b, 1} then = { , {a}, {b}, {1}, {a,b}, {a,1}, {b,1}, {a,b,1}}  Note: empty set is a subset of every set. Partition: A partition  of a nonempty set A is a subset of such that Each set element P   is not empty For D, F  , D  F, it holds that D  F =  The union of all P   is equal to A. Example: A = {a, b, c}, then  = {{a,b}, {c}}. Also  = {{a}, {b}, {c}}. But this is not: M = {{a, b}, {b}, {c}}

©Silberschatz, Korth and Sudarshan1.13Database System Concepts, 5 th Ed., slide version 5.0, June 2005 Cartesian Products and Relations Cartesian product: Given two sets A and B, the Cartesian product between and A and B, denoted by A x B, is the set of all ordered pairs (a,b) such a  A and b  B. Formally: A x B = {(a,b): a  A and b  B} Example: A = {1, 2}, B = {a, b}, then A x B = {(1,a), (1,b), (2,a), (2,b)}. A binary relation R on two sets A and B is a subset of A x B. Example: A = {1, 2}, B = {a, b},  then A x B = {(1,a), (1,b), (2,a), (2,b)},  and one possible R  A x B = {(1,a), (2,a)} JIQ: How many binary relations exist among two finite sets?

©Silberschatz, Korth and Sudarshan1.14Database System Concepts, 5 th Ed., slide version 5.0, June 2005 N-ary Relations Let A1, A2, …, An be n sets, not necessarily distinct, then an n-ary relation R on A1, A2, …, An is a sub-set of A1 x A2 x … x An. Formally: R  A1 x A2 x … x An R = {(a 1, a 2, …,a n ) : a 1  A 1 ∧ a 2  A 2 ∧ … ∧ a n  A n } Example:  R = set of all real numbers  R x R x R = three-dimensional space  P = {(x, y, z): x  R ∧ x  0 ∧ y  R ∧ y  0 ∧ z  R and z  0} = Set of all three-dimensional points that have positive coordinates

©Silberschatz, Korth and Sudarshan1.15Database System Concepts, 5 th Ed., slide version 5.0, June 2005 The Relational Model (CACM 13:6 1970) Relation = Set of Tuples = Subset of A1 x A2 x … x An NO duplicates and NO order Rows correspond to entities or objects Columns correspond to attributes of properties of objects Tables are interrelated through the use of attributes or foreign keys Queries: Combine tables to form new tables Edgar “Ted” Codd Turing 1981