Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Write a Query with an Inner Join
How To Write a Query with an Inner Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements
✍: 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.
2007-04-19, 4642👍, 0💬
Popular Posts:
Can two catch blocks be executed? No, once the proper catch section is executed the control goes fin...
How do we get the current culture of the environment in windows and ASP.NET? “CultureInfo.CurrentCul. ..
What Happens to Indexes If You Drop a Table? - Oracle DBA FAQ - Managing Oracle Table Indexes If you...
What's the difference between J2SDK 1.5 and J2SDK 5.0? There is no difference, Sun Microsystems just...
How To Merge Cells in a Row? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells If you wan...