Relationele Databases 2002/2003



Vergelijkbare documenten
Relationele Databases 2002/2003

Relationele Databases 2002/2003

Data Handling Ron van Lammeren - Wageningen UR

ISO SQL: Structured Query Language

SQL: query taal met. woorden. ISO SQL: Structured Query Language. de SQL basis query structuur. voorbeeld: doel: intuitieve query taal

Datamodelleren en databases 2011

Travel Survey Questionnaires

i(i + 1) = xy + y = x + 1, y(1) = 2.

Luister alsjeblieft naar een opname als je de vragen beantwoordt of speel de stukken zelf!

Normaliseren versie 1.1

Alle opgaven tellen even zwaar, 10 punten per opgave.

Chapter 4 Understanding Families. In this chapter, you will learn

Introductie (relationele) databases

DBMS. DataBase Management System. Op dit moment gebruiken bijna alle DBMS'en het relationele model. Deze worden RDBMS'en genoemd.

SAMPLE 11 = + 11 = + + Exploring Combinations of Ten + + = = + + = + = = + = = 11. Step Up. Step Ahead

Databases (INFODB) 24 januari 2007

Opgave 2 Geef een korte uitleg van elk van de volgende concepten: De Yield-to-Maturity of a coupon bond.

Understanding and being understood begins with speaking Dutch

Databases (INFODB) 20 april 2010

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 8 februari 2010

Classification of triangles

Engels op Niveau A2 Workshops Woordkennis 1

Thinking of development

(1) De hoofdfunctie van ons gezelschap is het aanbieden van onderwijs. (2) Ons gezelschap is er om kunsteducatie te verbeteren

RECEPTEERKUNDE: PRODUCTZORG EN BEREIDING VAN GENEESMIDDELEN (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

Preschool Kindergarten

Relationele databases

Online Resource 1. Title: Implementing the flipped classroom: An exploration of study behaviour and student performance

Tentamen Databases. 18 december :00-12:00, Educatorium Gamma

ISO Query By Example

ANGSTSTOORNISSEN EN HYPOCHONDRIE: DIAGNOSTIEK EN BEHANDELING (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

Tentamen Databases voor iku

Het beheren van mijn Tungsten Network Portal account NL 1 Manage my Tungsten Network Portal account EN 14

Settings for the C100BRS4 MAC Address Spoofing with cable Internet.

1. In welk deel van de wereld ligt Nederland? 2. Wat betekent Nederland?

ALGORITMIEK: answers exercise class 7

TECHNISCHE UNIVERSITEIT EINDHOVEN. Faculteit Wiskunde en Informatica

OPEN TRAINING. Onderhandelingen met leveranciers voor aankopers. Zeker stellen dat je goed voorbereid aan de onderhandelingstafel komt.

Installatie van Windows 10 op laptops. Windows 10 installation on laptops

Add the standing fingers to get the tens and multiply the closed fingers to get the units.

DBMS SQL. Relationele databases. Sleutels. DataBase Management System. Inleiding relationele databases. bestaan uit tabellen.

De Relatie tussen de Fysieke Omgeving en het Beweeggedrag van Kinderen gebruik. makend van GPS- en Versnellingsmeterdata

SQL Aantekeningen 3. Maarten de Rijke 22 mei 2003

2019 SUNEXCHANGE USER GUIDE LAST UPDATED

Ontpopping. ORGACOM Thuis in het Museum

Building the next economy met Blockchain en real estate. Lelystad Airport, 2 november 2017 BT Event

Databases - Inleiding

B1 Woordkennis: Spelling

Keuzetwijfels in de Emerging Adulthood rondom Studie- en Partnerkeuze. in Relatie tot Depressie

COGNITIEVE DISSONANTIE EN ROKERS COGNITIVE DISSONANCE AND SMOKERS

Melding Loonbelasting en premies Aanmelding werkgever. Registration for loonbelasting en premies Registration as an employer

(Big) Data in het sociaal domein

Daylight saving time. Assignment

LDA Topic Modeling. Informa5ekunde als hulpwetenschap. 9 maart 2015

MyDHL+ Van Non-Corporate naar Corporate

Activant Prophet 21. Prophet 21 Version 12.0 Upgrade Information

Group work to study a new subject.

L.Net s88sd16-n aansluitingen en programmering.

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

[TOETS SQL INLEIDING]

Persoonlijke informatie / Personal information

L.Net s88sd16-n aansluitingen en programmering.

Tentamen Databases voor ica

20 twenty. test. This is a list of things that you can find in a house. Circle the things that you can find in the tree house in the text.

LONDEN MET 21 GEVARIEERDE STADSWANDELINGEN 480 PAGINAS WAARDEVOLE INFORMATIE RUIM 300 FOTOS KAARTEN EN PLATTEGRONDEN

Academisch schrijven Inleiding

Cambridge Assessment International Education Cambridge International General Certificate of Secondary Education. Published

Het is geen open boek tentamen. Wel mag gebruik gemaakt worden van een A4- tje met eigen aantekeningen.

After that, the digits are written after each other: first the row numbers, followed by the column numbers.

Buy Me! FILE 5 BUY ME KGT 2

Ius Commune Training Programme Amsterdam Masterclass 16 June 2016

S e v e n P h o t o s f o r O A S E. K r i j n d e K o n i n g

Calculator spelling. Assignment

Issues in PET Drug Manufacturing Steve Zigler PETNET Solutions April 14, 2010

Tentamen Informatica 6, 2IJ60,

Inhoud. Voorwoord Belangrijkste kenmerken van dit boek De opzet van dit boek Over de auteur Woord van dank

Een vrouw, een kind en azijn (Dutch Edition)

PDF hosted at the Radboud Repository of the Radboud University Nijmegen

Yes/No (if not you pay an additional EUR 75 fee to be a member in 2020

Ius Commune Training Programme Amsterdam Masterclass 15 June 2018

Hertentamen 8D040 - Basis beeldverwerking

Contextanalyse. Patrick v/d Vlist

Puzzle. Fais ft. Afrojack Niveau 3a Song 6 Lesson A Worksheet. a Lees de omschrijvingen. Zet de Engelse woorden in de puzzel.

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

Pesten onder Leerlingen met Autisme Spectrum Stoornissen op de Middelbare School: de Participantrollen en het Verband met de Theory of Mind.

Hoofdstuk 9: Object Constraint language (OCL) Prof. Dr. Olga De Troyer. Constraints

AVG / GDPR -Algemene verordening gegevensbescherming -General data Protection Regulation

Ius Commune Training Programme Amsterdam Masterclass 22 June 2017

DATAMODEL SQL. Middelbare School. Versie 1.0 Datum 30 oktober 2010 Auteur Mark Nuyens, studentnummer: Groep TDI 1

Het omzetten van een ER-diagram naar SQL

TABASCO. Taak gestuurd leren bij Engels

Free Electives (15 ects)

CHROMA STANDAARDREEKS

Transcriptie:

1 Relationele Databases 2002/2003 Hoorcollege 4 8 mei 2003 Jaap Kamps & Maarten de Rijke April Juli 2003 Plan voor Vandaag Praktische dingen 3.1, 3.2, 3.3, 3.4, 3.5. SQL Aantekeningen 2 Tabellen. Theorie Silberschatz et al: hoofdstuk 3: Relationele Model ( 3.3 3.5). Silberschatz et al: hoofdstuk 4: SQL ( 4.1 4.4). 2 3 Docenten: Huishoudelijke Zaken 1. Jaap Kamps, Email: kamps@science.uva.nl 2. Maarten de Rijke, Email: mdr@science.uva.nl URL voor de cursus: http://www.science.uva.nl/~kamps/rdb/, of http://www.science.uva.nl/~mdr/teaching/rdb/0203/ Practicum Eerste inleveropdracht wordt nagekeken http://www.science.uva.nl/~borkur/teaching/rdb0203/ Deadline tweede inleveropdracht: 6 juni 2002 3.1 Design a database for a university s registrar s office. The office maintains data about each class, including the instructor, the number of students enrolled, and the time and place of the class meetings. For each student-class pair, a grade is recorded Oplossing (onderstreepte attributen staan voor de primary key): student(ss#, name) class(dept,courseno,time,place,enrollment) instructor(i ss#,name) takes(ss#,dept,courseno,grade) teaches(dept,courseno,i ss#) 4 5 3.2 Describe the differences in meaning between the terms relation and relation schema. Illustrate your answer by referring to your solution to Exercise 3.1. 3.3 Design a relational database corresponding to the E-R diagram of Figure 3.38. Een relatie schema is een type definitie, en een relatie is een instantie van dat schema. Een voorbeeld van een relatie schema is: Student-schema = (ss#,name) Een voorbeeld van relatie gebaseerd op dat schema is: ss# name 123-45-6789 Tom Jones 456-78-9123 Mary Brown 6 7 3.3 Design a relational database corresponding to the E-R diagram of Figure 3.38. De relationele database is als volgt. person(driver-id,name,address) car(license,year,model) accident(report-number,location,date) owns(driver-id,license) participated(report-number,driver-id,license,damage-amount) We nemen aan dat het report-nummer een unieke persoon en auto identificeren. Indien er meerdere autos en personen bij het ongeluk betrokken zijn, krijgen die een ander report-number. 3.4 In Chapter 2, we showed how to represent many-to-many, manyto-one, one-to-many, and one-to-one relationship sets. Explain how primary keys help us to represent such relationship sets in the relational model. Stel de primary key van relatie-schema R is {A i1, A i2..., A in } en de primary key van relatie-schema S is {B i1, B i2,..., B im }. Dan kan een relatie tussen beide worden gerepresenteerd als een tuple (A i1, A i2,..., A in, B i1, B i2,..., B im ). In een one-to-one relatie zal iedere waarde {A i1, A i2,..., A in } in precies 1 tuple voorkomen, en hetzelfde geldt voor iedere {B i1, B i2,..., B im }.

8 9 3.4 (vervolg)... In een many-to-one relatie (e.g., many A - one B) zal iedere waarde {A i1, A i2,..., A in } maar 1 keer voorkomen, en iedere waarde {B i1, B i2,..., B im } kan meerdere malen voorkomen. In een many-to-many relatie zullen waarden {A i1, A i2,..., A in } en {B i1, B i2,..., B im } beiden meerdere keren kunnen voorkomen. Echter, in alle drie gevallen zal een tuple (A i1, A i2,..., A in, B i1, B i2,..., B im ) niet meer dan 1 keer voorkomen, dat is, de verzameling {A j1, A j2,..., A jn, B k1, B k2,..., B km } is een superkey. 3.5 Consider the relational database of Figure 3.39. For each of the following queries, given an expression in the relational algebra. Figure 3.39: employee(person-name,street,city) works(person-name, company-name, salary) company(company-name, city) manages(person-name, manager-name) 10 11 3.5a. Find the names of all employees who work for First Bank Corporation. 3.5b. Find the names and cities of residence of all employees who work for First Bank Corporation. Π person-name(σ company-name= First Bank Corporation (works)) Π person-name,city(employee (σ company-name= First Bank Corporation (works))) 12 13 3.5c. Find the names, street address, and cities of residence of all employees who work for First Bank Corporation and earn more than $10,000 per annum. Π person-name,street,city(σ company-name= First Bank Corporation salary>10000 3.5d. Find the names of all employees who live in the same city as the company for which they work. Π person-name(employee works company) (works employee)) We nemen aan dat iedere persoon slechts voor 1 bedrijf werkt. Als personen voor meerdere bedrijven werken, dan krijgen we alleen de personen die meer dan $10,000 per jaar verdienen bij alleen de First Bank Corporation. 14 15 3.5e. Find the names of all employees who live in the same city and on the same street as do their managers. Π person-name((employee manages) (manager-name=employee2.person-name employee.street=employee2.street employee.city=employee2.city)(ρ employee2 (employee))) 3.5f. Find the names of all employees in this database who do not work for First Bank Corporation. Als we aannemen dat alle personen voor precies 1 bedrijf werken: Π person-name(σ company-name First Bank Corporation (works)) Als we toestaan dat personen in de database mogen voorkomen (e.g., in employee) zonder werknemer te zijn (e.g, in works), of als personen een baan bij meerdere bedrijven mogen hebben, is het probleem gecompliceerder: Π person-name(employee) Π person-name(σ company-name= First Bank Corporation (works))

16 17 3.5g. Find the names of all employees who earn more than every employee of Small Bank Corporation. The following solution assumes that all people work for at most one company. Π person-name(works) (Π works.person-name(works (works.salary works2.salary works2.company-name= Small Bank Corporation ) (ρ works2 (works)))) 3.5h. Assume the companies may be located in several cities. Find all companies located in every city in which Small Bank Corporation is located. Π company-name(company (Π city (σ company-name= Small Bank Corporation (company)))) De Small Bank Corporation zal 1 van de antwoorden zijn. 18 19 Database System Concepts Hoofdstuk 3 Vervolg van het relationele model Vorige keer: 6 fundamentele operatoren: select, project, union, set difference, Cartesian product, en rename. 4 gedefinieerde operatoren: set intersectie, natural join, division, en assignment. Vandaag secties 3.3, 3.4 en 3.5 20 21 22 23

24 25 26 27 28 29 30 31

32 33 34 35 36 37 38 39

40 41 42 43 44 45 Database System Concepts Hoofdstuk 4 Over Structured Query Language of SQL Meest gebruikte query taal. Een relationele taal. Een niet-procedurele taal. Ruwweg secties 4.1 tot en met 4.4 46 47

48 49 50 51 52 53 54 55

56 57 58 59 60 61 62 63

64 65 66 67 Overzicht Vandaag Database System Concepts. Hoofdstuk 3: Relationele model ( 3.3 3.5). Hoofdstuk 4: SQL ( 4.1 4.4). Opgaven: 3.1, 3.2, 3.3, 3.4, 3.5. SQL Aantekeningen 2. Tabellen. 68 69 Volgende Keer bij Relationele Databases End! Opgaven voor volgende keer (22 mei): 3.8, 3.9, 3.10 (alleen voor relationele algebra). 4.1, 4.4, 4.5 SQL Aantekeningen 3. Meer Queries. Rest SQL (Hoofdstuk 4).