Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Joins Introduction

    • 0
    • 6
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 243
    Comment on it

    SQL JOIN is used to combine data from two or more different table based on a common field between them in a relational database.

    There are 5 types of JOIN:

    1. INNER JOIN
    2. LEFT JOIN
    3. RIGHT JOIN
    4. FULL JOIN
    5. CROSS JOIN

    INNER JOIN: This SQL query returns all the common rows between the tables joined.

    LEFT JOIN: This SQL query returns all the rows from the left table and the matched rows from the right table.

    RIGHT JOIN: This SQL query returns all the rows from the right table and the matched rows from the left table.

    FULL JOIN: This SQL query returns all the rows from both tables when there is a match in one of the tables.

    FULL JOIN: This SQL query returns returns the Cartesian product of rows from tables in the join.


    INNER JOIN SYNTAX:

    SELECT column_name(s)
    FROM table1
    INNER JOIN table2
    ON table1.column_name=table2.column_name;

    LEFT JOIN SYNTAX:

    SELECT column_name(s)
    FROM table1
    LEFT JOIN table2
    ON table1.column_name=table2.column_name;

    RIGHT JOIN SYNTAX:

    SELECT column_name(s)
    FROM table1
    RIGHT JOIN table2
    ON table1.column_name=table2.column_name;

    FULL JOIN SYNTAX:

    SELECT column_name(s)
    FROM table1
    FULL OUTER JOIN table2
    ON table1.column_name=table2.column_name;

    CROSS JOIN SYNTAX:

    SELECT column_name(s)
    FROM table1 CROSS JOIN table2;

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: