Principles of Database Systems

Σχετικά έγγραφα
ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΑΤΡΩΝ - ΤΜΗΥΠ ΒΑΣΕΙΣ ΔΕΔΟΜΕΝΩΝ Ι

Principles of Database Systems

ΣΧΕ ΙΑΣΜΟΣ ΒΑΣΕΩΝ Ε ΟΜΕΝΩΝ ΚΑΙ ΚΑΝΟΝΙΚΟΠΟΙΗΣΗ

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ

Lecture 2. Soundness and completeness of propositional logic

The Simply Typed Lambda Calculus

2 Composition. Invertible Mappings

ΣΧΕΔΙΑΣΜΟΣ ΒΑΣΕΩΝ ΔΕΔΟΜΕΝΩΝ ΚΑΙ ΚΑΝΟΝΙΚΟΠΟΙΗΣΗ. Σχεδιασμός Σχεσιακών ΒΔ και Κανονικοποίηση 1

The challenges of non-stable predicates

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

EE512: Error Control Coding

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Reminders: linear functions

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

C.S. 430 Assignment 6, Sample Solutions

Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2)

Approximation of distance between locations on earth given by latitude and longitude

Διδάσκων: Παναγιώτης Ανδρέου

Example Sheet 3 Solutions

Math 6 SL Probability Distributions Practice Test Mark Scheme

Fractional Colorings and Zykov Products of graphs

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Section 8.3 Trigonometric Equations

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

ΗΥ360 Αρχεία και Βάσεις Δεδομένων

derivation of the Laplacian from rectangular to spherical coordinates

Commutative Monoids in Intuitionistic Fuzzy Sets

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

Numerical Analysis FMN011

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

Συναρτησιακές Εξαρτήσεις 7ο Φροντιστήριο. Βάρσος Κωνσταντίνος

Lecture 22: Functional Dependencies and Normalization

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

PARTIAL NOTES for 6.1 Trigonometric Identities

Συναρτησιακές Εξαρτήσεις 7ο Φροντιστήριο. Βάρσος Κωνσταντίνος

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Chapter 3: Ordinal Numbers

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008

Every set of first-order formulas is equivalent to an independent set

1. Introduction and Preliminaries.

TMA4115 Matematikk 3

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Στο εστιατόριο «ToDokimasesPrinToBgaleisStonKosmo?» έξω από τους δακτυλίους του Κρόνου, οι παραγγελίες γίνονται ηλεκτρονικά.

Block Ciphers Modes. Ramki Thurimella

Matrices and Determinants

Partial Differential Equations in Biology The boundary element method. March 26, 2013

Other Test Constructions: Likelihood Ratio & Bayes Tests

Statistical Inference I Locally most powerful tests

Section 7.6 Double and Half Angle Formulas

Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequality for metrics: Let (X, d) be a metric space and let x, y, z X.

Finite Field Problems: Solutions

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

Homomorphism in Intuitionistic Fuzzy Automata

Congruence Classes of Invertible Matrices of Order 3 over F 2

2. Let H 1 and H 2 be Hilbert spaces and let T : H 1 H 2 be a bounded linear operator. Prove that [T (H 1 )] = N (T ). (6p)

Srednicki Chapter 55

Bounding Nonsplitting Enumeration Degrees

About these lecture notes. Simply Typed λ-calculus. Types

Section 9.2 Polar Equations and Graphs

Solutions to Exercise Sheet 5

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ. ΕΠΛ342: Βάσεις Δεδομένων. Χειμερινό Εξάμηνο Φροντιστήριο 10 ΛΥΣΕΙΣ. Επερωτήσεις SQL

Ακεραιότητα και Ασφάλεια Μέρος 1 Σχεδιασμός Βάσεων Δεδομένων

( ) 2 and compare to M.

CRASH COURSE IN PRECALCULUS

Abstract Storage Devices

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

14 Lesson 2: The Omega Verb - Present Tense

CE 530 Molecular Simulation

Exercises to Statistics of Material Fatigue No. 5

Section 1: Listening and responding. Presenter: Niki Farfara MGTAV VCE Seminar 7 August 2016

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

Inverse trigonometric functions & General Solution of Trigonometric Equations

ST5224: Advanced Statistical Theory II

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with

12. Radon-Nikodym Theorem

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

και τα οφέλη για τον τομέα ανάπτυξης γης και οικοδομών

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Mean bond enthalpy Standard enthalpy of formation Bond N H N N N N H O O O

VBA ΣΤΟ WORD. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Version ΗΜΙΤΕΛΗΣ!!!!

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

Galatia SIL Keyboard Information

A Note on Intuitionistic Fuzzy. Equivalence Relation

Solutions to the Schrodinger equation atomic orbitals. Ψ 1 s Ψ 2 s Ψ 2 px Ψ 2 py Ψ 2 pz

Κανονικοποίηση(Normalization) ΒΑΣΕΙΣ ΔΕΔΟΜΕΝΩΝ 9 ο Εξάμηνο2013. Κανονικές Μορφές. Πρώτη Κανονική Μορφή (1NF) Βάσεις Δεδομένων. Περικλής Α.

Συναρτησιακές Εξαρτήσεις Σχεδιασμός Βάσεων Δεδομένων

Trigonometry 1.TRIGONOMETRIC RATIOS

From the finite to the transfinite: Λµ-terms and streams

Problem Set 3: Solutions

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS

Homework 3 Solutions

Transcript:

Principles of Database Systems V. Megalooikonomou Συναρτησιακές Εξαρτήσεις (Functional Dependencies) (based on notes by Silberchatz,Korth, and Sudarshan and notes by C. Faloutsos)

General Overview Formal query languages rel algebra and calculi Commercial query languages SQL QBE, (QUEL) Integrity constraints Συναρτησιακές Εξαρτήσεις Normalization - good DB design

Overview Domain; Ref. Integrity constraints Assertions and Triggers Security Συναρτησιακές Εξαρτήσεις why definition Armstrong s axioms closure and cover

Συναρτησιακές Εξαρτήσεις motivation: good tables takes1 (ssn, c-id, grade, name, address) good or bad?

Συναρτησιακές Εξαρτήσεις takes1 (ssn, c-id, grade, name, address) Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις Bad - why? Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις Redundancy space inconsistencies insertion/deletion anomalies (later ) What caused the problem?

Συναρτησιακές Εξαρτήσεις name depends on ssn define depends Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις a b Definition: a functionally determines b ( a συναρτησιακά καθορίζει το b ) Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις Informally: if you know a, there is only one b to match Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις formally: Y ( t1[ x] = t2[ x] t1[ y] = t2[ y]) if two tuples agree on the attribute, they *must* agree on the Y attribute, too (e.g., if ssn is the same, so should address) a functional dependency is a generalization of the notion of a key -Why?

Συναρτησιακές Εξαρτήσεις, Y can be sets of attributes other examples?? Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις ssn -> name, address ssn, c-id -> grade Ssn c -id G rade Name A ddress 123 413 A s mith Main 123 415 B s mith Main 123 211 A s mith Main

Συναρτησιακές Εξαρτήσεις K is a superkey for relation R iff K -> R K is a candidate key for relation R iff: K -> R for no a K, a -> R

Συναρτησιακές Εξαρτήσεις Closure (κλειστότητα) of a set of FD: all implied FDs e.g.: ssn -> name, address ssn, c-id -> grade imply (συνάγουν) ssn, c-id -> grade, name, address ssn, c-id -> ssn

FDs - Armstrong s axioms Closure of a set of FD: all implied FDs e.g.: ssn -> name, address ssn, c-id -> grade how to find all the implied ones, systematically?

FDs - Armstrong s axioms Armstrong s axioms guarantee soundness and completeness: Reflexivity Y Y (ανακλαστικότητα): e.g., ssn, name -> ssn Augmentation Y W YW (επαυξητικότητα): e.g., ssn->name then ssn,grade-> ssn,grade

FDs - Armstrong s axioms Transitivity (μεταβατικότητα) Y Y Z Z ssn->address address-> county-tax-rate THEN: ssn-> county-tax-rate

FDs - Armstrong s axioms Reflexivity: Y Y Augmentation: Y W YW Transitivity: Y Y Z Z sound and complete

FDs finding the closure F+ F + = F repeat for each functional dependency f in F + apply reflexivity and augmentation rules on f add the resulting Συναρτησιακές Εξαρτήσεις to F + for each pair of Συναρτησιακές Εξαρτήσεις f 1 and f 2 in F + if f 1 and f 2 can be combined using transitivity then add the resulting functional dependency to F + until F + does not change any further We can further simplify manual computation of F + by using the following additional rules

FDs - Armstrong s axioms Additional rules: Union (ένωση) Decomposition (διασπαστικότητα) Pseudo-transitivity (ψευδομεταβατικότητα) Y Z YZ YW Y YZ Z Y W Z Z

FDs - Armstrong s axioms Prove Union from the three axioms: Y? Z YZ

FDs - Armstrong s axioms Prove Union from the three axioms: Y (1) Z (2) (1) + augm. w/ Z (2) + augm. w/ but (3) + (4) is ; thus and Z transitivity YZ Z (3) (4) YZ

FDs - Armstrong s axioms Prove Pseudo-transitivity: Y Y W Y YW YW? Y Z W Z Y Y Z Z

FDs - Armstrong s axioms Prove Decomposition Y Y W Y YW YZ? Y Z Y Y Z Z

FDs - Closure F+ Given a set F of FD (on a schema) F+ is the set of all implied FD. E.g., takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address }F

FDs - Closure F+ ssn, c-id -> grade ssn-> name, address ssn-> ssn ssn, c-id-> address c-id, address-> c-id... F+

FDs - Closure F+ R=(A,B,C,G,H,I) F= { A->B A->C CG->H CG->I B->H} Some members of F+: A->H AG->I CG->HI

FDs - Closure A+ Given a set F of FD (on a schema) A+ is the set of all attributes determined by A: takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address }F {ssn}+ =??

FDs - Closure A+ takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address }F {ssn}+ ={ssn, name, address }

FDs - Closure A+ takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address }F {c-id}+ =??

FDs - Closure A+ takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address }F {c-id, ssn}+ =??

FDs - Closure A+ if A+ = {all attributes of table} then A is a candidate key

FDs - Closure A+ Algorithm to compute α +, the closure of α under F result := α; while (changes to result) do for each β γin F do begin if β resul then result := result γ end

FDs - Closure A+ (example) R = (A, B, C, G, H, I) F = {A B, A C, CG H, CG I, B H} (AG) + 1. result = AG 2. result = ABCG (A C and A B) 3. result = ABCGH(CG H and CG AGBC) 4. result = ABCGHI (CG I and CG AGBCH) Is AG a candidate key? 1. Is AG a super key? 1. Does AG R? 2. Is any subset of AG a superkey? 1. Does A + R? 2. Does G + R?

FDs - A+ closure Diagrams AB->C (1) A->BC (2) B->C (3) A->B (4) A B C

FDs - canonical cover Fc Given a set F of FD (on a schema) Fc (ελάχιστο κάλλυμα) is a minimal set of equivalent FD. E.g., takes(ssn, c-id, grade, name, address) ssn, c-id -> grade ssn-> name, address ssn,name-> name, address ssn, c-id-> grade, name F

FDs - canonical cover Fc Fc ssn, c-id -> grade ssn-> name, address ssn,name-> name, address ssn, c-id-> grade, name F

FDs - canonical cover Fc why do we need it? define it properly compute it efficiently

FDs - canonical cover Fc why do we need it? easier to compute candidate keys define it properly compute it efficiently

FDs - canonical cover Fc define it properly - three properties every FD a->b has no extraneous attributes on the RHS same for the LHS all LHS parts are unique

FDs - canonical cover Fc extraneous attribute: if the closure is the same, before and after its elimination or if F-before implies F-after and vice-versa

FDs - canonical cover Fc ssn, c-id -> grade ssn-> name, address ssn,name-> name, address ssn, c-id-> grade, name F

FDs - canonical cover Fc Algorithm: examine each FD; drop extraneous LHS or RHS attributes merge FDs with same LHS repeat until no change

FDs - canonical cover Fc Trace algo for AB->C (1) A->BC (2) B->C (3) A->B (4)

FDs - canonical cover Fc Trace algo for AB->C (1) A->BC (2) B->C (3) A->B (4) (4) and (2) merge: AB->C (1) A->BC (2) B->C (3)

FDs - canonical cover Fc AB->C (1) A->BC (2) B->C (3) AB->C (1) A->B (2 ) B->C (3) in (2): C is extr.

FDs - canonical cover Fc AB->C (1) A->B (2 ) B->C (3) B->C (1 ) A->B (2 ) B->C (3) in (1): A is extr.

FDs - canonical cover Fc B->C (1 ) A->B (2 ) B->C (3) (1 ) and (3) merge A->B (2 ) B->C (3) nothing is extraneous: canonical cover

FDs - canonical cover Fc BEFORE AB->C (1) A->BC (2) B->C (3) A->B (4) AFTER A->B (2 ) B->C (3)

Overview - conclusions Domain; Ref. Integrity constraints Assertions and Triggers Συναρτησιακές Εξαρτήσεις why definition Armstrong s axioms closure and cover