SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    outter join, inner join, left join, right join

    I don't see the point of making so many kinds of join, that drives me confusing reading the mysql document.

    Can you help me to explain the when to use each one of them, in plain english ?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    there are 3 basic types of joins: inner, outer, and cross

    inner joins are used when you want a specific match in both tables

    outer joins are used when you want all rows from one table, with or without matching rows in the other table

    cross joins are used when you want all possible combinations of rows

    see also this post: http://www.sitepoint.com/forums/show...2&postcount=18

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    A left join and a right join are both outer joins and define which of the two tables you want all the results from.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Juxst thought I would chip in to say, excellent answers, I think. Thank you.

    Y'know, if you had sufficient time on your hands, I bet you could rewrite the whole MySQL docs so that we learners could understand them more quickly.

    bazz


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •