inner-join

INNER JOIN ON vs WHERE clause

蹲街弑〆低调 提交于 2019-11-25 22:13:45
问题 For simplicity, assume all relevant fields are NOT NULL . You can do: SELECT table1.this, table2.that, table2.somethingelse FROM table1, table2 WHERE table1.foreignkey = table2.primarykey AND (some other conditions) Or else: SELECT table1.this, table2.that, table2.somethingelse FROM table1 INNER JOIN table2 ON table1.foreignkey = table2.primarykey WHERE (some other conditions) Do these two work on the same way in MySQL ? 回答1: INNER JOIN is ANSI syntax which you should use. It is generally

Update statement with inner join on Oracle

柔情痞子 提交于 2019-11-25 21:37:59
问题 I have a query which works fine in MySQL, but when I run it on Oracle I get the following error: SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - \"SQL command not properly ended\" The query is: UPDATE table1 INNER JOIN table2 ON table1.value = table2.DESC SET table1.value = table2.CODE WHERE table1.UPDATETYPE=\'blah\'; 回答1: That syntax isn't valid in Oracle. You can do this: UPDATE table1 SET table1.value = (SELECT table2.CODE FROM table2 WHERE table1.value = table2.DESC)

What is the difference between “INNER JOIN” and “OUTER JOIN”?

有些话、适合烂在心里 提交于 2019-11-25 21:33:20
问题 Also how do LEFT JOIN , RIGHT JOIN and FULL JOIN fit in? 回答1: Assuming you're joining on columns with no duplicates, which is a very common case: An inner join of A and B gives the result of A intersect B, i.e. the inner part of a Venn diagram intersection. An outer join of A and B gives the results of A union B, i.e. the outer parts of a Venn diagram union. Examples Suppose you have two tables, with a single column each, and data as follows: A B - - 1 3 2 4 3 5 4 6 Note that (1,2) are unique