Giter VIP home page Giter VIP logo

full-join's Introduction

GitHub Logo

FULL JOINS

The SQL FULL JOIN combines the results of both left and right outer joins.

The joined table will contain all records from both the tables and fill in NULLs for missing matches on either side.

Syntax

The basic syntax of a FULL JOIN is as follows −

    SELECT table1.column1, table2.column2...
    FROM table1
    FULL JOIN table2
    ON table1.common_field = table2.common_field;

Here, the given condition could be any given expression based on your requirement.

Example

Now, let us join these two tables using the FULL JOIN as follows.

    SELECT  Customers.CustomerID, Customers.CustomerName, ORDERS.OrderDate
        FROM Customers
        FULL JOIN ORDERS
        ON Customers.CustomerID = ORDERS.CustomerID;

This would produce the following result −

CustomerID CustomerName OrderDate
51 Bottom-Dollar Marketse 2017-03-20
71 Split Rail Beer & Ale 2016-11-21
72 Princesa Isabel Vinhoss 2016-12-29
73 Folk och fä HB 2017-01-04
74 Consolidated Holdings 2017-03-28

If your Database does not support FULL JOIN (MySQL does not support FULL JOIN), then you can use UNION ALL clause to combine these two JOINS as shown below.

full-join's People

Contributors

sangamangreg avatar

Watchers

James Cloos avatar Suraj Jadhav avatar PradeepJaiswar avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.