Übung Datenbanksysteme I Relationale Algebra

Slides:



Advertisements
Ähnliche Präsentationen
PC-Kauf im IV. Quartal 1998 Dipl.-Ing. Jörg Dannenberg
Advertisements

Kardinalität von binären Beziehungen (1)
Bounded Model Checking II
Entity-Relationship-Ansatz
Bauinformatik II Softwareanwendungen 1
Kapitel 3: Das Relationenmodell
Projekt: WinfoSys - PC Labor Informationstechnik WS 08/09.
Lehrstuhl Informatik III, DatenbanksystemeMartin Wimmer Übung zu Architektur und Implementierung von Datenbanksystemen 1 Implementierungen des Join- Operators.
Prof. Dr. T. Kudraß1 Relationen-Algebra. Prof. Dr. T. Kudraß2 Relationale Anfragesprachen Query Language (QL): Manipulation und Retrieval von Daten einer.
Übung Datenbanksysteme SQL-Anfragen (2)
Einführung Dateisystem <-> Datenbanksystem
1 Der Zusammenbau der Azubirechner des 1. Lehrjahres Von Thomas Kaiser.
1 Polymorphe Operatoren Zunächst: Beschränkung auf Operatoren zum Abfragen der in Relationen enthaltenen Information. Forderung nach mathematischer Exaktheit.
PCs und Zubehör.
Die Grundterminologie
Optimaler Computerarbeitsplatz
Übung Datenbanksysteme II Index- strukturen
WS 2012/13 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #6 SQL (Teil 3)
WS 2013/14 Datenbanksysteme Do 17:00 – 18:30 R Vorlesung #6 SQL (Teil 3)
WS 2009/10 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #3 Das relationale Modell (Teil 2)
WS 2007/08 Datenbanksysteme Mi 17:00 – 18:30 R Vorlesung #3 Relationale Anfragesprachen.
WS 2011/12 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #8 Anfragebearbeitung.
SS 2004 Datenbanken 4W Mi 13:30 – 15:00 G 2.30 Vorlesung #5 Relationale Anfragesprachen.
WS 2012/13 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #2 Das relationale Modell (Teil 1)
WS 2011/12 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #3 Das relationale Modell (Teil 2)
WS 2013/14 Datenbanksysteme Do 17:00 – 18:30 R Vorlesung #2 Das relationale Modell (Teil 1)
WS 2013/14 Datenbanksysteme Fr 17:00 – 18:30 R Vorlesung #3 Das relationale Modell (Teil 2)
WS 2012/13 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #9 Anfragebearbeitung.
WS 2007/08 Datenbanksysteme Mi 17:00 – 18:30 R Vorlesung #9 Anfragebearbeitung (Teil 1)
WS 2007/08 Datenbanksysteme Mi 17:00 – 18:30 R Vorlesung #5 SQL (Teil 2)
WS 2012/13 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #3 Das relationale Modell (Teil 2)
Von Oliver Richard. Notebook Preis: Arbeits-PC Großer Bildschirm, Videoschnitt, Bildbearbeitung Gewicht: nicht zu schwer Vorgaben.
Datenbanksysteme für hörer anderer Fachrichtungen
WS 2011/12 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #5 SQL (Teil 2)
Das relationale Modell
Aufbau und Funktionsweise eines Computers
WS 2013/14 Datenbanksysteme Do 17:00 – 18:30 R Vorlesung #9 Anfragebearbeitung.
SQL - Structured Query Language AIFB SS (1/9) Join-Operationen in SQL-92(1/9) Syntax einer Join-Operation: join-op := CROSS JOIN | [NATURAL]
Ich bau nicht mit Ihr.. Ich bau mit Ihr. Ich bau nicht mit Ihr.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation III Vorlesung 1 WS 2001/02 Punkt-in-Landkarte I (Streifenkarte)
WS 2004/2005 Datenbanken II - 5W Mi 17:00 – 18:30 G 3.18 Vorlesung #3 Anfragebearbeitung (Teil 1)
Grundlagen des Relationenmodells
1 Polymorphe Operatoren Zunächst: Beschränkung auf Operatoren zum Abfragen der in Relationen enthaltenen Information. Forderung nach mathematischer Exaktheit.
Vorlesung #2 Das relationale Modell (Teil 1)
1 Differenzierte Verbindungsoperationen (1) Beobachtung: Einfach zu formulierende Verbindungen wie ein Natural Join sind nicht als solche dokumentiert.
Erweiterung bzgl. der Kardinalität. (1|9)
Algorithmen und Datenstrukturen 1 SS 2002
Vorlesung Datenbanksysteme vom Anfragebearbeitung  Logische Optimierung.
MAYA KINDLER 5C NOTEBOOK-KAUF. WAS WOLLEN MEINE ELTERN? Schönes Design Schnelle Leistung Einfache Bedienung Nicht zu groß Euro.
NOTEBOOKS Grundausstattung und Preisvergleich. Bekannte Hersteller AppleHPSonyToshiba.
© Andreas Dirnberger Referat Intel-Prozessoren Intel-Prozessoren Gliederung: Prozessoren: CentrinoCentrino, CeleronCeleron, Pentium 44, Pentium.
Übungsblatt 4 Erläuterungen Wintersemester 15/16 DBIS.
IS: Datenbanken, © Till Hänisch 2000 Relationenalgebra Die mathematische Grundlage von relationalen Datenbanken.
Computerhardware Paul Pumsenberger. Allgemein ● Materielle Teil des Computers ●,angreifbar' ● Geht (fast) nie kaputt ● Gegensatz: Software – Oft fehlerhaft,
WS 2015/16 Datenbanksysteme Fr 17:00 – 18:30 R Vorlesung #3 Das relationale Modell (Teil 2)
Mein Eigenbau Computer Bachinger Paul Informatik 1AHWIL 2015/16.
Technische Universität München Übung zur Einführung in die Informatik für Hörer anderer Fachrichtungen im Sommersemester 2010 Sitzung 8: Die relationale.
Übung Datenbanksysteme I Transaktionen, Selektivität, XML
PC Aufrüsten, Auftrag 1 Systemtools, Benchmark
Übung Datenbanksysteme I Embedded SQL, Stored Procedures, JDBC
Übung Datenbanksysteme I SQL
Präsentation Binär.
Triumph Bonneville T120 Mod. 2016
Vorlesung #4 Relationales Kalkül und SQL (Teil 1)
Übung Datenbanksysteme I Besprechung
Vorlesung #5 SQL (Teil 2).
BIKE INFO 16/2016 Triumph Thruxton 1200 R Mod. 16.
Produktschulungspräsentation – Laptop-Akkus
Harley Davidson Street 750 Mod. 2018
 Präsentation transkript:

Übung Datenbanksysteme I Relationale Algebra Thorsten Papenbrock G-3.1.09, Campus III Hasso Plattner Institut

Übersicht Relationale Algebra Unäre Operatoren  Binäre Operatoren Operator Beschreibung  (pi) Projektion  (sigma) Selektion  (delta) Duplikateliminierung  (rho) Umbenennung  (tau) Sortierung  (gamma) Gruppierung Operator Beschreibung  Schnittmenge  Vereinigung  Differenz (auch „\“) × Kreuzprodukt ⋈ Natürlicher Join ⋈ Theta-Join |⋈ Left outer Join ⋈| Right outer Join |⋈| Full outer Join ⋉ Semijoin DBSI - Übung Relationale Algebra Thorsten Papenbrock

Aufgabe: Kardinalitäten bestimmen Gegeben: Relation R mit m Tupeln Relation S mit n Tupeln Gesucht: Die minimale und maximale Anzahl von Tupeln in folgenden Ausdrücken: Ausdruck minimal maximal R  S R ⋈ S C(R)  S L(R) – S DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Kardinalitäten bestimmen Gegeben: Relation R mit m Tupeln Relation S mit n Tupeln Gesucht: Die minimale und maximale Anzahl von Tupeln in folgenden Ausdrücken: Ausdruck minimal maximal R  S R ⋈ S C(R)  S L(R) – S max(m,n) m + n DBSI - Übung m  n m  n Relationale Algebra m Thorsten Papenbrock

Übersicht: Relationale Übungsschemata Modellnummer Prozessorgeschwindigkeit [MHz] Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Festplattengröße [GB] Geschwindigkeit und Typ des Laufwerks Bildschirm- auflösung DBSI - Übung Typ (laser, ink-jet, bubble) Preis [Euro] Relationale Algebra Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Welche PC-Modelle haben eine Geschwindigkeit von minde- stens 1000 MHz?“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Welche PC-Modelle haben eine Geschwindigkeit von minde- stens 1000 MHz?“ DBSI - Übung Relationale Algebra model(speed≥1000(PC)) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Welche Hersteller bauen Laptops mit einer Harddisk von mindestens 10 GB Größe?“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Welche Hersteller bauen Laptops mit einer Harddisk von mindestens 10 GB Größe?“ DBSI - Übung Relationale Algebra maker(hd≥10(Product ⋈ Laptop)) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Farbe [true, false] Typ [laser, ink-jet, bubble] Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde die Modellnummern aller Farblaserdrucker.“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Farbe [true, false] Typ [laser, ink-jet, bubble] Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde die Modellnummern aller Farblaserdrucker.“ DBSI - Übung Relationale Algebra model(color=true ∧ type=‘laser‘ (Printer)) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde die Modellnummer und den Preis aller Produkte (jeden Typs), die von Hersteller ‘Apple‘ gebaut werden.“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde die Modellnummer und den Preis aller Produkte (jeden Typs), die von Hersteller ‘Apple‘ gebaut werden.“ Warum? DBSI - Übung Relationale Algebra model,price(maker=‘Apple‘(Product ⋈ ( model,price(PC)  model,price(Laptop)  model,price(Printer)))) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Hersteller, die Laptops, aber keine PCs herstellen.“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Hersteller, die Laptops, aber keine PCs herstellen.“ DBSI - Übung Nötig? Relationale Algebra δ(maker(Product ⋈ Laptop)) – δ(maker(Product ⋈ PC)) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Harddisk-Größen, die in mehr als zwei PCs vorkommen.“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Harddisk-Größen, die in mehr als zwei PCs vorkommen.“ DBSI - Übung Relationale Algebra hd(Anzahl>2(hd,count(model) → Anzahl(PC))) Thorsten Papenbrock

Aufgabe: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Paare von PCs mit gleicher Festplatten- und Hauptspeichergröße. Vermeide dabei doppelte Paare.“ DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Deutsch  relationale Algebra Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: „Finde alle Paare von PCs mit gleicher Festplatten- und Hauptspeichergröße. Vermeide dabei doppelte Paare.“ DBSI - Übung Relationale Algebra (PC1(PC)) ⋈PC1.HD=PC2.HD ∧ PC1.RAM=PC2.RAM ∧ PC1.model<PC2.model (PC2(PC)) Thorsten Papenbrock

Aufgabe: Relationale Algebra  Deutsch Product(maker, model, type) Beispieltupel: (‘Lenovo‘, 1005, ‘pc‘) PC(model, speed, ram, hd, rd, price) Beispieltupel: (1005, 1000, 128, 20, ‘12xDVD‘, 1499) Laptop(model, speed, ram, hd, screen, price) Beispieltupel: (2008, 650, 64, 10, 12.1, 1249) Printer(model, color, type, price) Beispieltupel: (3005, true, ‘bubble‘, 200) Anfrage: D.a(A.b=B.b ∧ A.a=C.g ∧ B.a=D.g ∧ C.a=D.a ( A(a,b,c,d,e,f)(Laptop)×B(a,b,c,d,e,f)(PC)×C(a,g,h)(Product)×D(a,g,h)(Product))) DBSI - Übung Relationale Algebra Thorsten Papenbrock

Lösung: Relationale Algebra  Deutsch model model D.a(A.b=B.b ∧ A.a=C.g ∧ B.a=D.g ∧ C.a=D.a ( A(a,b,c,d,e,f)(Laptop)×B(a,b,c,d,e,f)(PC)×C(a,g,h)(Product)×D(a,g,h)(Product)))  D.a(A.b=B.b ∧ C.a=D.a ( (A(a,b,c,d,e,f)(Laptop) ⋈ C(a,g,h)(Product)) × (B(a,b,c,d,e,f)(PC) ⋈ D(a,g,h)(Product))))  D.a(A.b=B.b ( (A(a,b,c,d,e,f)(Laptop) ⋈ C(a,g,h)(Product)) ⋈C.a=D.a (B(a,b,c,d,e,f)(PC) ⋈ D(a,g,h)(Product)))) maker speed DBSI - Übung maker Relationale Algebra „Finde alle Hersteller, die mindestens einen Laptop und einen PC anbieten, deren Prozessoren dieselbe Taktfrequenz haben.“ Thorsten Papenbrock

Übung Datenbanksysteme I Relationale Algebra Thorsten Papenbrock G-3.1.09, Campus III Hasso Plattner Institut