SQL NATURAL JOIN

SQL NATURAL JOIN is a same as EQUI JOIN but different is resulting contains allow only one column for each pair of same columns named. Record set contains haven't same name columns are found.


SQL Natural Join

Example Table

Considering following SQL NATURAL JOIN example, category, product is our example table.

SQL> SELECT * FROM category;
CATEGORY_IDCATEGORY_NAME
1Mobiles
2Laptops
3Laptops
4Cameras
5Gaming
SQL> SELECT * FROM product;
CATEGORY_IDPRODUCT_NAME
1Nokia
1Samsung
2HP
2Dell
3Apple
4Nikon
NullPlaystation

Run it...   »

SQL Natural join query use NATURAL JOIN keyword to specify table name.

Example

SQL> SELECT *
    FROM product NATURAL JOIN category;

CATEGORY_ID PRODUCT_NAME       CATEGORY_ID CATEGORY_NAME
----------- ------------------ ----------- -------------------
          1 Nokia                        1 Mobiles
          1 Samsung                      1 Mobiles
          2 HP                           2 Laptops
          2 Dell                         2 Laptops
          3 Apple                        3 Tablet
          4 Nikon                        4 Cameras

6 rows selected.

Run it...   »