Inner Joins - PowerPoint PPT Presentation

Loading...

PPT – Inner Joins PowerPoint presentation | free to download - id: 1e678c-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Inner Joins

Description:

Normalization is the process of splitting information into separate tables, but ... To do the previous join in Access you would need to nest the join statements. ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 10
Provided by: stevec2
Category:
Tags: inner | joins | nest | the

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Inner Joins


1
Inner Joins
  • Putting it back together

2
Overview
  • Normalization is the process of splitting
    information into separate tables, but often we
    want to see and use the information together
  • Joins bring the information from separate tables
    back together for queries

3
Types of Joins
  • There are several types of joins
  • Inner Joins
  • Outer Joins
  • Cross Joins
  • Full Joins
  • We are only going to worry about inner joins for
    now

4
Keywords
  • Inner joins introduce three new keywords
  • INNER
  • JOIN
  • ON

5
A Simple Inner join
  • SELECT ArtistName, Track_Title FROM Artist a
    INNER JOIN Tracks t ON a.ArtistIDt.ArtistID
  • In the SELECT clause list all the fields you wish
    to see from all the tables.
  • Put one of the tables in the FROM Clause
  • Place the other table after the INNER JOIN Clause
  • In the ON clause you tell which field relates the
    tables (key and Foreign Key, though the order
    doesnt matter)
  • Note the aliasing of the tables

6
Joining More than 2 Tables
  • SELECT ArtistName, Track_Title, Cd_Title
  • FROM Artists a
  • INNER JOIN Tracks t
  • ON a.ArtisitIDt.ArtistID
  • INNER JOIN Cds c
  • ON c.CD_ID t.CD_ID
  • WHERE ArtistNameU2

7
In Access
  • To do the previous join in Access you would need
    to nest the join statements.
  • The next slide shows how Access handles the inner
    join
  • It is often easier to use the alternative syntax
    (Last slide)

8
Access Inner Join
  • SELECT ArtistName, CD_Title, Track_Title
  • FROM CDs
  • INNER JOIN (Artists
  • INNER JOIN Tracks
  • ON Artists.ArtistID Tracks.ArtistID) ON
    CDs.CD_ID Tracks.CD_ID
  • WHERE (((ArtistName)"U2"))

9
An Alternate Way
  • SELECT ArtistName, Track_Title, Cd_Title
  • FROM Artists a, Tracks t, Cds c
  • WHERE a.ArtistIDt.ArtistID
  • AND c.CD_IDt.CD_ID
  • AND ArtistNameU2
  • This is an older way. It was the only way Oracle
    supported before 9i
About PowerShow.com