mysql中left的含义,mysql中的左連接和右連接有什么區別[重復]

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相反,即顯示來自第二(右)表的所有記錄,並且僅匹配來自第一(左)表的記錄。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值