## 数据库表连接的简单解释 • 内连接（inner join）
• 外连接（outer join）
• 左连接（left join）
• 右连接（right join）
• 全连接（full join） • 只返回两张表匹配的记录，这叫内连接（inner join）。
• 返回匹配的记录，以及表 A 多余的记录，这叫左连接（left join）。
• 返回匹配的记录，以及表 B 多余的记录，这叫右连接（right join）。
• 返回匹配的记录，以及表 A 和表 B 各自的多余记录，这叫全连接（full join）。 ```SELECT * FROM A
INNER JOIN B ON A.book_id=B.book_id;

SELECT * FROM A
LEFT JOIN B ON A.book_id=B.book_id;

SELECT * FROM A
RIGHT JOIN B ON A.book_id=B.book_id;

SELECT * FROM A
FULL JOIN B ON A.book_id=B.book_id;
```

```SELECT * FROM A
LEFT JOIN B
ON A.book_id=B.book_id
WHERE B.id IS null;
```

```SELECT * FROM A
FULL JOIN B
ON A.book_id=B.book_id
WHERE A.id IS null OR B.id IS null;
``` （完）

[返回] [原文链接]
{"ft_lang_label":"__label__zh","ft_lang_prob":0.96330583,"math_prob":0.77396625,"size":1666,"snap":"2020-24-2020-29","text_gpt3_token_len":1140,"char_repetition_ratio":0.14620939,"word_repetition_ratio":0.1734104,"special_character_ratio":0.26770708,"punctuation_ratio":0.073015876,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95421547,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-07-09T11:58:13Z\",\"WARC-Record-ID\":\"<urn:uuid:d11436d3-82d4-4c46-8208-e714fba1b90d>\",\"Content-Length\":\"13662\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4f41deeb-7ea3-4b33-970c-26c3ecf24947>\",\"WARC-Concurrent-To\":\"<urn:uuid:d53adc1d-bb21-4325-abe4-59df5ff67e97>\",\"WARC-IP-Address\":\"129.226.190.210\",\"WARC-Target-URI\":\"http://m.udpwork.com/item/17287.html\",\"WARC-Payload-Digest\":\"sha1:VCCR7QY5HZNMLBNOD77ECMDM4VFANDA7\",\"WARC-Block-Digest\":\"sha1:JN3IOZ3CT3UXRMPBIMCSNZRPBVIYXP6W\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-29/CC-MAIN-2020-29_segments_1593655899931.31_warc_CC-MAIN-20200709100539-20200709130539-00014.warc.gz\"}"}