Collections:
Query with an Inner Join in Oracle
How To Write a Query with an Inner Join in Oracle?
✍: FYIcenter.com
If you want to query from two tables with an inner join, you can use the INNER JOIN ... ON clause in the FROM clause. The following query returns output with an inner join from two tables: employees and departments. The join condition is that the department ID in the employees table equals to the department ID in the departments table:
SQL> SELECT employees.first_name, employees.last_name, 2 departments.department_name 3 FROM employees INNER JOIN departments 4 ON employees.department_id=departments.department_id; FIRST_NAME LAST_NAME DEPARTMENT_NAME -------------------- -------------------- --------------- Steven King Executive Neena Kochhar Executive Lex De Haan Executive Alexander Hunold IT Bruce Ernst IT David Austin IT Valli Pataballa IT ......
Note that when multiple tables are used in a query, column names need to be prefixed with table names in case the same column name is used in both tables.
⇒ Define and Use Table Alias Names in Oracle
⇐ Ways to Join Two Tables in a Single Query in Oracle
2019-10-27, 1859🔥, 0💬
Popular Posts:
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...
How To Drop a Stored Procedure in Oracle? If there is an existing stored procedure and you don't wan...
What Is SQL*Plus in Oracle? SQL*Plus is an interactive and batch query tool that is installed with e...