today:
644
yesterday:
1,155
Total:
1,131,814

INNER JOIN

admin 2023.05.19 23:09 Views : 128

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
129 127.0.0.1 issues admin 2024.09.09 154
128 GP 영수증 FOOTER admin 2024.06.30 294
127 GP 영수증 HEADER admin 2024.06.30 294
126 LAST DAY SQL admin 2024.01.19 271
125 Null Display Value admin 2024.01.10 266
124 영수증 2023 file admin 2024.01.04 419
123 Column Data 일괄 추가 admin 2023.11.24 239
122 Using SQL*Plus to Unlock and Change Passwords admin 2023.06.04 249
121 Reversing Require HTTPS admin 2023.06.04 146
120 ipconfig admin 2023.06.03 122
119 127.0.0.1:8080/apex/ admin 2023.06.03 136
118 CHANGE TABLE NAME admin 2023.05.31 148
117 DATE -> DAY CONVERT SQL admin 2023.05.25 94
116 YEAR EXPRESSIONS admin 2023.05.25 88
115 GRAPH (BAR) SQL SAMPLE admin 2023.05.25 91
114 Monthly SUM admin 2023.05.22 126
» INNER JOIN admin 2023.05.19 128
112 LOOP TABLE UPDATE admin 2023.05.19 256
111 Global pages admin 2023.05.09 85
110 ORACLE COLLECTION admin 2023.05.08 90