Fundamentals/ICY: Databases 2013/14 WEEK 9 –Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,

Slides:



Advertisements
Similar presentations
Chapter 3 : Relational Model
Advertisements

Relational Model (CB Chapter 4) CPSC 356 Database Ellen Walker Hiram College.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Fundamentals/ICY: Databases 2013/14 Week 6: Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Discussion #25 1/13 Discussion #25 Set Topics & Applications.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Sets 1.
Sets 1.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Database Architecture The Relational Database Model.
Fundamentals/ICY: Databases 2012/13 WEEK 11 (relational operators & relational algebra) John Barnden Professor of Artificial Intelligence School of Computer.
Intro to Maths for CS: 2013/14 Sets (2) – OPTIONAL MATERIAL John Barnden Professor of Artificial Intelligence School of Computer Science University of.
Fundamentals/ICY: Databases 2013/14 REVISION WEEK John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
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.
Fundamentals/ICY: Databases 2010/11 WEEK 11 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2010/11 WEEK 5 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2012/13 REVISION WEEK John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Fundamentals/ICY: Databases 2012/13 WEEK 5 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2012/13 WEEK 7 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
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.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Fundamentals/ICY: Databases 2013/14 Week 10 –Monday –Normalization, contd John Barnden Professor of Artificial Intelligence School of Computer Science.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – Relational Model.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Intro to Maths for CS: 2012/13 Sets (week 1 part) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
IS 325 Notes for Monday October 21, Set Theory Concepts Understanding set theory helps us to: see things in terms of systems organize things into.
Fundamentals/ICY: Databases 2012/13 WEEK 10 (maths, normalization) John Barnden Professor of Artificial Intelligence School of Computer Science University.
Fundamentals/ICY: Databases 2012/13 WEEK 11 – 4 th Normal Form (optional material) John Barnden Professor of Artificial Intelligence School of Computer.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
CompSci 102 Discrete Math for Computer Science
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Fundamentals/ICY: Databases 2013/14 WEEK 9 –Friday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Fundamentals/ICY: Databases 2010/11 REVISION WEEK John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Chapter 2 With Question/Answer Animations. Section 2.1.
Introduction Episode 0 What is TOC (Theory of Computation) about? Giorgi Japaridze Theory of Computability Subject: The fundamental mathematical properties.
Fundamentals/ICY: Databases 2013/14 Week 5: Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Discrete Mathematics Set.
Fundamentals/ICY: Databases 2012/13 Week 4 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2013/14 Week 4: Friday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Intro to Maths for CS: 2012/13 Sets (end, week 3) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
1 Section 1.2 Sets A set is a collection of things. If S is a set and x is a member or element of S we write x  S. Othewise we write x  S. The set with.
Fundamentals/ICY: Databases 2013/14 Week 11 – Monday – relations, ended. John Barnden Professor of Artificial Intelligence School of Computer Science University.
Fundamentals/ICY: Databases 2012/13 WEEK 9 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
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.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
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.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Set Definition: A set is unordered collection of objects.
Intro to Maths for CS: 2012/13 Sets (contd, week 2)
Fundamentals/ICY: Databases 2013/14 WEEK 8 –Monday
BCS2143 – Theory of Computer Science
SETS & FUNCTIONS NOTATION & TERMINOLOGY
Fundamentals/ICY: Databases 2010/11 WEEK 6
        { } Sets and Venn Diagrams Prime Numbers Even Numbers
Discrete Mathematics CS 2610
Fundamentals/ICY: Databases 2013/14 WEEK 6 - Friday
John Barnden Professor of Artificial Intelligence
Terminology and Symbols
Presentation transcript:

Fundamentals/ICY: Databases 2013/14 WEEK 9 –Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK

Class Test: ANSWERS – see site Marking – by end of term

Reminder

Two Other Properties uUnion distributes over intersection:     A  (B  C) = (A  B)  (A  C) uIntersection distributes over union:    A  (B  C) = (A  B)  (A  C)

New

Same Difference? uExercises for bath-time: Is the difference operation commutative or associative? And does it take part in any distributivity with the other operations?

“Tuples” in a Table The tuples are just lists representing the rows:  ‘ A’, ‘Chopples’, 37 >  ‘ Z’, ‘Blurp’, NULL >  ‘ F’, ‘Rumpel’, 88 > PERS-IDNAMEAGE AChopples ZBlurp FRumpel88 People

Table Rows are “Tuples” uIn a table, each attribute has a “value domain” – the set of values that the attribute can have. E.g., the set of integers, the set of all character strings of any length, or the set of character strings of a specific format and length. uIf the attribute allows NULL values, we include NULL in the value domain as well. uThe values in a row form a tuple of values from the respective value domains. Just a list of the values, one for each attribute.

Tuples in General uA “tuple” in general is an ordered sequence of items of any sort. We will only deal with finite tuples. Items CAN be duplicated. l Can also be called a “vector” in other CS terminology. uNotation by angle brackets and commas:  6, JAB, 5, “JAB”, 5, , 9>  Singleton and empty tuples:, <> uThe concatenation ( ⃘ ) of two tuples is just the result of putting them end to end to get one tuple. l ⃘ = l ⃘ <> =  Ex: is concatenation commutative? associative?

Cartesian Products uThe set of all possible tuples formed from some list of sets is called the Cartesian product of the sets. Notation, e.g.: D  E  F  G  H if D, E, F, G, H are the sets—not necessarily different. The tuples are all possible tuples of the form where d  D, e  E, …, h  H

Examples uLet A = {3, 8, 2} and B = {‘jjj’, ‘bb’}. Then A  B = {,,,,, }. B  B = {,,, }. A   =  =   A A  {TRUE} = {,, }

“Relations” uAny subset at all of a Cartesian product is called a relation on the sets in question (D, E, … above) l even the whole of the product (even if infinite) l and even the empty set. uI.e., a relation on D, E, …, H is just some set of tuples that are each of form where d  D, e  E, …, h  H.

Examples uLet A = {3, 8, 2} and B = {‘jjj’, ‘bb’}. The Cartesian product A  B = {,,,,, }. uSome relations on A and B: l {,, } l { }  l A  B l 

Rows as forming a Relation uSo, for a given table, the tuples corresponding to all possible rows that you could create using whatever values you like from the value domains, forms the Cartesian product of the value domains of the table. uAnd, provided the table does not have repeated rows: AT ANY MOMENT the actual set of rows, considered as tuples, is a relation on the table’s value domains. l NB: crucial here that no row is exactly repeated, because a mathematical set cannot have repeated elements.

Relation from a Table The relation at the moment is   ‘ A’, ‘Chopples’, 37 >,  ‘ Z’, ‘Blurp’, NULL >,  ‘ F’, ‘Rumpel’, 88 >  PERS-IDNAMEAGE AChopples ZBlurp FRumpel88 People

A Table as a Relation? uPeople loosely talk about tables being relations. This is mathematically inaccurate for several reasons: 1)The table properly speaking includes not just the rows but also the attribute names themselves, their domains, specification of primary and foreign keys, etc. 2)It’s only the rows at any given moment that form a relation. When a value in the table changes or a row is added or deleted, the mathematical relation is replaced by a different one. 3)Relations do not cater for tables with repeated rows. ((ASIDE: But see next slide for a way out.)) But OK if you know what you (and those people) mean.

((ASIDE: “Bags” in Maths)) uA variant of sets called “bags” (or “multisets”) is used in maths (and CS) and allows repeated members. There are union, etc. operations that respect the repetitions. uSo bags and their operations are a better fit to DB tables and notably their repetition-respecting operations (e.g. UNION ALL) than sets and their operations are. uBut bags are non-standard and they’re not normally covered at an introductory level. uSee the databases textbook by Garcia-Molina et al 2009 for bags and their use in the DB area.