29
The difference is in the way tables are joined if there are no common records.
如果沒有共同記錄,則表的不同之處在於表的連接方式。
JOIN is same as INNER JOIN and means to only show records common to both tables. Whether the records are common is determined by the fields in join clause. For example:
JOIN與INNER JOIN相同,表示僅顯示兩個表共有的記錄。記錄是否通用由join子句中的字段決定。例如:
FROM t1
JOIN t2 on t1.ID = t2.ID
means show only records where the same ID value exists in both tables.
表示僅顯示兩個表中存在相同ID值的記錄。
LEFT JOIN is same as LEFT OUTER JOIN and means to show all records from left table (i.e. the one that precedes in SQL statement) regardless of the existance of matching records in the right table.
LEFT JOIN與LEFT OUTER JOIN相同,意味着顯示左表中的所有記錄(即SQL語句之前的記錄),無論右表中是否存在匹配記錄。
RIGHT JOIN is same as RIGHT OUTER JOIN and means opposite of LEFT JOIN, i.e. shows all records from the second (right) table and only matching records from first (left) table.
RIGHT JOIN與RIGHT OUTER JOIN相同,意味着與LEFT JOIN相反,即顯示來自第二(右)表的所有記錄,並且僅匹配來自第一(左)表的記錄。