1 / 11

SQL

SQL. Meerdere tabellen: Relaties en Joins. Opbouw Relationele database. Genormaliseerde tabellen Overtolligheid (redundantie) eruit halen Link mogelijk tussen koppelvelden Relaties zichtbaar maken in Access: Hulpmiddelen voor databases  Relaties 1 op 1 relaties 1 op n relaties

ailis
Télécharger la présentation

SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL Meerdere tabellen: Relaties en Joins

  2. Opbouw Relationele database • Genormaliseerde tabellen • Overtolligheid (redundantie) eruit halen • Link mogelijk tussen koppelvelden • Relaties zichtbaar maken in Access: • Hulpmiddelen voor databases  Relaties • 1 op 1 relaties • 1 op n relaties • Primaire sleutels, vreemde sleutels

  3. Voorbeeld: autoverhuur

  4. De tabel auto

  5. Gerelateerde gegevens bij auto

  6. Alles komt samen in tabel Verhuur

  7. Opvragingen SQL meerdere tabellen SELECT <veldnaam> [,<veldnaam>] FROM <tabelnaam> [,<tabelnaam>] [WHERE <voorwaarde>] ; SELECT auto.kenteken, Merk, type, DatumVerhuur, DatumRetour FROM auto, verhuur

  8. Ongewenst resultaat!

  9. Oplossing • Om te voorkomen dat voor elke rij uit de ene tabel een koppeling wordt gemaakt naar elke rij uit de andere tabel moet je WHERE inschakelen! SELECT auto.kenteken, Merk, type, DatumVerhuur, DatumRetour FROM auto, verhuur WHERE auto.kenteken = verhuur.kenteken

  10. Gewenste resultaat

  11. Opdracht • Bestudeer paragraaf 10.8 (eenvoudige opvragingen uit meerdere tabellen) uit het boek “Databaseontwikkeling Access 2007” • Maak opgave 10.5 uit het boek

More Related