Results 1 to 7 of 7

Thread: joins in Sql server

  1. #1
    Join Date
    Feb 2004
    Posts
    33

    joins in Sql server

    I have a very silly question.Does anyone know What is result of Inner Join ( left Join, Outer Join)
    I tried to search but did not find any results for this.I would really appreciate if someone helps me out.
    Thanks,
    Siri

  2. #2
    Join Date
    Nov 2002
    Location
    DE
    Posts
    246
    Did you check BOL (= Books onLine = the SQL Server online documentation) . this is usually the first place to search in.

    Anyway: Assume two tables:
    Categories (catid, catname)
    1, science
    2, novel
    3, newspaper

    Lectures (lectureid, title, catid)
    1, 'E=mc2', 1
    2, 'Database Theory', 1
    3, 'Tommyknockers', 2

    Inner Join: joins two tables togeher and displays all combinations out of both tables where the joined fields are identical.
    Taking the sample tables this means: If you inner join Categories and lectures on catid you get a list of all books with their corresponding catname

    Left Join or better: Left outer Join
    If you create a left outer join from categories to lectures you will get all categories with the books associated to them plus the non-used category newspaper

  3. #3
    Join Date
    Feb 2003
    Posts
    1,048
    Inner Joins are simple enough as it only returns the data where the join criteria match on both sides. When I was first learning SQL, it helped me to visualize the outer joins in my head.

    I would picture two tables (like an open table in Enterprise Manager) and visualize that a left join would return all records on the left side and matching records on the right side. A right join is the opposite.

  4. #4
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    is a cross join the same as a union ?

  5. #5
    Join Date
    Sep 2002
    Posts
    5,938
    No, they are different.

  6. #6
    Join Date
    Feb 2003
    Posts
    1,048
    A Cross Join joins each row from the first (top) input with each row from the second (bottom) input.

    A union isn't a join at all. A union combines results from two or more queries into one result set so that the records are returned as separate records, not combined.

  7. #7
    Join Date
    Feb 2004
    Posts
    33
    Thank you for the help..
    Siri

Posting Permissions

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