Category: Joins

  • UNION vs JOIN

    SQL provides various relational operators to handle data that is spread across multiple tables in a relational database. Out of them, UNION and JOIN queries are fundamentally used to combine data from multiple tables. Even though they are both used for the same purpose, i.e. to combine tables, there are many differences between the working…

  • Left Join vs Right Join

    The main difference between the Left Join and Right Join can be observed in the way tables are joined. They are both types of Outer Joins; that is, they retain unmatched rows in one table and discard the unmatched rows of another. Left Join preserves the unmatched rows of left table while Right join preserves…

  • UPDATE JOIN

    To update the data entered in a single database table using SQL, you can use the UPDATE statement. However, to update the data in multiple database tables, we need to use the UPDATE… JOIN clause. For instance, if a student changes their primary phone number and wishes to update it in their organizational database, the information needs…

  • DELETE JOIN

    Simple deletion operation in SQL can be performed on a single record or multiple records of a table. And to delete records from multiple tables, the most straightforward approach would be to delete records from one table at a time. However, SQL makes it easier by allowing the deletion operation to be performed on multiple…

  • Self Join

    Self Join, as its name suggests, is a type of join that combines the records of a table with itself. Suppose an organization, while organizing a Christmas party, is choosing a Secret Santa among its employees based on some colors. It is designed to be done by assigning one color to each of its employees…

  • Full Join

    The SQL Full Join SQL Full Join creates a new table by joining two tables as a whole. The joined table contains all records from both the tables and fills NULL values for missing matches on either side. In short, full join is a type of outer join that combines the result-sets of both left and…

  • Cross Join

    The SQL Cross Join An SQL Cross Join is a basic type of inner join that is used to retrieve the Cartesian product (or cross product) of two individual tables. That means, this join will combine each row of the first table with each row of second table (i.e. permutations). A Cartesian product, or a cross product,…

  • Right Join

    SQL Joins are used to retrieve records from multiple tables based on a given condition. A Join includes the records that satisfy the given condition and outer join results a table that contains both matched and unmatched rows. Left Outer Join, as discussed in the previous tutorial, is used to find the union of two…

  • Left Join

    Joins are used to retrieve records from two or more tables based on a logical relation between them. This relation is defined using a join condition. As we discussed in the previous chapters, there are two types of Joins − Left Join is a type of outer join that retrieves all the records from the…

  • Inner Join

    An SQL Join clause is used to combine multiple related tables in a database, based on common fields/columns. There are two major types of joins: Inner Join and Outer Join. Other joins like Left Join, Right Join, Full Join etc. Are just subtypes of these two major joins. In this tutorial, we will only learn about the Inner Join. The…