Write SQL query to join two tables?

Nileshsinh Purabiya
Nileshsinh Purabiya

Posted On: Apr 10, 2020

 

A JOIN condition is applied to join rows from two or added tables, founded on a similar column connecting them.

The various kinds of the JOINs in SQL:

  • LEFT (OUTER) JOIN: Returns every record from the left chart, and the harmonized reports from the right record.
  • (INNER) JOIN: Returns reports which have harmonizing values in both charts.
  • RIGHT (OUTER) JOIN: Returns every record from the right record, and the harmonized reports from the left chart.
  • FULL (OUTER) JOIN: Returns every record while there is in harmony with each left or right record.

The general query to join is as below for the list of the orders with all customer information in it.

SELECT OrderNumber, TotalAmount, FirstName, LastName, City, Country
  FROM Order JOIN Customer
    ON Order.CustomerId = Customer.Id

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Cyient Software Engineer Interview Questions

    What are basics of OOPS Concepts?

    OOP concepts in Java are the main ideas behind Java's Object-Oriented Programming. They are an abstraction, encapsulation, inheritance, and polymorphism. There are four main OOP concepts in Java. The...

    Cyient Software Engineer Interview Questions

    What is Abstract class and interface?

    Abstract Class: An abstract class is a class that is declared abstract, it may or may not include abstract methods. When an abstract class is subclassed, the subclass usually provides implementations ...

    Cyient Software Engineer Interview Questions

    What is Exception handling?

    Exception Handling is one of the powerful mechanisms to handle runtime errors so that the normal flow of the application can be maintained....