SQL for joining two tables
What is the SQL statement that can be used to join two tables?
SELECT tableA.columnA, tableA.columnB, tableB.columnX, tableB.columnY FROM tableA, tableB WHERE tableA.columnA = tableB.columnX AND tableA.columnB = tableB.columnY;In the same above, the rows from the two tables are joined where ColumnA = ColumnX and ColumnB = ColumnY. You can code any join condition this way. Oracle also supports the ANSI SQL standard join syntax. The above query in ANSI SQL standard would look like the following:
SELECT tableA.columnA, tableA.columnB, tableB.columnX, tableB.columnY FROM tableA INNER JOIN tableB ON tableA.columnA = tableB.columnX AND tableA.columnB = tableB.columnY;
Dig Deeper on Oracle and SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.
Meet all of our Oracle Database / Applications experts
View all Oracle Database / Applications questions and answers
Start the conversation
0 comments