today:
26
yesterday:
158
Total:
999,664

INNER JOIN

admin 2023.05.19 22:09 Views : 37

What is Inner Join in Oracle?

The INNER join is such a join when equijoins and nonequijoins are performed, rows from the source and target tables are matched using a join condition formulated with equality and inequality operators, respectively. These are referred to as inner joins.

Syntax:

SELECT table1.column, table2.column
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;

Pictorial presentation of Syntax:

pictorial presentation of oracle inner join syntax

Pictorial presentation of Inner Join:

pictorial presentation of oracle inner join

Example:

The following SQL statement will return department no, department name and the city for a the same location no.

Sample table: locations

 

Sample table: departments

 

SELECT a.department_id, a.department_name, b.city
FROM departments a
INNER JOIN locations b
ON a.location_id = b.location_id;

Sample Output:

DEPARTMENT_ID DEPARTMENT_NAME                CITY
------------- ------------------------------ ---------------------
           60 IT                             Southlake
           50 Shipping                       South San Francisco
           10 Administration                 Seattle
           30 Purchasing                     Seattle
           90 Executive                      Seattle
          100 Finance                        Seattle
          110 Accounting                     Seattle
          120 Treasury                       Seattle
          130 Corporate Tax                  Seattle
          140 Control And Credit             Seattle
          150 Shareholder Services           Seattle
          160 Benefits                       Seattle
          170 Manufacturing                  Seattle
          180 Construction                   Seattle
          190 Contracting                    Seattle
          200 Operations                     Seattle
          210 IT Support                     Seattle
          220 NOC                            Seattle
          230 IT Helpdesk                    Seattle
          240 Government Sales               Seattle
          250 Retail Sales                   Seattle
          260 Recruiting                     Seattle
          270 Payroll                        Seattle
           20 Marketing                      Toronto
           40 Human Resources                London
           80 Sales                          Oxford
           70 Public Relations               Munich

27 rows selected.

INNER JOINS: SQL and other Relational Databases

Previous: JOINS with USING Clause
Next: LEFT OUTER JOIN

No. Subject Author Date Views
126 ACTION admin 2019.01.11 6454
125 Fundamentals of PL/SQL admin 2016.05.10 2031
124 QR Code plugin admin 2017.11.30 1585
123 QR Code plugin Process admin 2017.11.30 962
122 How to Update Oracle XE Version admin 2018.02.23 929
121 GP PRINT admin 2018.05.31 917
120 INSTR admin 2016.05.19 785
119 SELECT last_name FROM admin 2018.12.12 742
118 TREE admin 2016.05.18 722
117 IMP admin 2018.10.08 717
116 JK admin 2019.02.05 700
115 CREATE TABLE admin 2018.09.25 471
114 APEX Password Change admin 2016.08.26 452
113 JavaScript for Member List admin 2016.08.17 427
112 Membership Management admin 2016.06.09 425
111 QRCODE admin 2020.05.25 405
110 control break admin 2016.06.25 388
109 SQL admin 2016.07.15 387
108 DATE Compare admin 2018.05.22 365
107 APEX Web Services Proxy Settings admin 2016.06.07 351