sql join multiple tables with conditions

Today, We want to share with you joins in sql with examples.In this post we will show you types of joins in sql, hear for SQL Joins Explained – Inner, Left, Right & Full Joins we will give you demo and example for implement.In this post, we will learn about SQL JOIN, JOIN Syntax, JOIN Differences, 3 tables with an example.

SQL | Join (Inner, Left, Right and Full Joins)

In this tutorial we learn to all about having Examples like as a Structure of an SQL INNER JOIN, Table Aliases make SQL Joins, SQL INNER Join, Self-Join, Non Equi-Joins or many more.

Also Read: SQL multiple joins for beginners with examples

Basic Structure of an SQL INNER JOIN

SELECT columnlist
FROM maintable
INNER JOIN secondtable ON join condition

Table Aliases make SQL Joins

SELECT  P.ProfileNm,
        P.SirNm
 FROM   Visitor.Visitor AS P
SELECT    P.ProfileNm,
          P.SirNm,
          PP.PhoneNumber
 FROM     Visitor.Visitor AS P
          INNER JOIN
          Visitor.VisitorPhone AS PP
          ON P.CareerEntityID = PP.CareerEntityID
 WHERE    P.SirNm LIKE 'C%'
 ORDER BY P.SirNm

SQL INNER Join with More than One Field

SELECT    C.Teacher,
          C.ClassName,
          S.Day,
          S.Hour
 FROM     Class AS C
          INNER JOIN
          Section AS S
          ON C.ClassName = S.ClassName
             AND C.Teacher = S.Teacher
          ORDER BY C.Teacher, S.Day, S.Hour

Self-Join

SELECT  D1.Name,
        D2.Name
 FROM   workforce.Branch AS D1
        INNER JOIN
        workforce.Branch AS D2
        ON d1.GroupName = d2.GroupName

Non Equi-Joins

SELECT    P1.MobileID,
          P1.Name
 FROM     Mobileion.Mobile AS P1
          INNER JOIN
          Mobileion.Mobile AS P2
          ON P1.Name = P2.Name
 ORDER BY P1.MobileNumber

I hope you get an idea about joins in sql with examples.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment