Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 4511👍, 0💬
Popular Posts:
Can Sub Procedure/Function Be Called Recursively? - Oracle DBA FAQ - Creating Your Own PL/SQL Proced...
How do we assign page specific attributes ? Page attributes are specified using the @Page directive.
How can we suppress a finalize method? GC.SuppressFinalize ()
How do I use a scriptlet to initialize a newly instantiated bean? A jsp:useBean action may optionall...
What Information Is Needed to Connect SQL*Plus an Oracle Server? - Oracle DBA FAQ - Introduction to ...