{"id":7931,"date":"2024-03-27T17:00:29","date_gmt":"2024-03-27T09:00:29","guid":{"rendered":"https:\/\/white-night.club\/?p=7931"},"modified":"2024-03-27T17:04:39","modified_gmt":"2024-03-27T09:04:39","slug":"ad166","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2024\/03\/27\/ad166\/","title":{"rendered":"175. \u7ec4\u5408\u4e24\u4e2a\u8868"},"content":{"rendered":"\n<p><a href=\"https:\/\/leetcode.cn\/problems\/combine-two-tables\/\">https:\/\/leetcode.cn\/problems\/combine-two-tables\/<\/a><\/p>\n\n\n\n<p>\u534a\u5e74\u6ca1\u78b0\u8fc7SQL\u4e86\uff0c\u627e\u70b9\u611f\u89c9\u3002<\/p>\n\n\n\n<p>\u5178\u4e2d\u5178\u4e4b\u5de6\u8054\u7ed3\u7ec4\u5408\u4e24\u8868\uff0c\u867d\u7136left join\u5177\u4f53\u5565\u65f6\u5019\u7528\u6211\u662f\u5df2\u7ecf\u5fd8\u7684\u5dee\u4e0d\u591a\u4e86\u3002\u6211\u5370\u8c61\u4e2d\u662f\u5f53B\u8868\u6570\u636e\u90fd\u80fd\u5728A\u8868\u4e2d\u627e\u5230\u5339\u914d\u7684\uff0c\u7528A left join B\uff0c\u5982\u679c\u627e\u4e0d\u5230\u7684\u5c31\u4f1a\u88ab\u5224\u7a7a\u5e76\u4e14\u4e5f\u4f1a\u88abselect\u51fa\u6765\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">SQL<\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Write your MySQL query statement below\nSELECT Person.firstName,Person.lastName,Address.city,Address.state\nFROM Person\nLEFT JOIN Address \nON Person.personId=Address.personId;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\"># Write your MySQL query <\/span><span style=\"color: #569CD6\">statement<\/span><span style=\"color: #D4D4D4\"> below<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> Person.firstName,Person.lastName,Address.city,Address.state<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> Person<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">LEFT JOIN<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">Address<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> Person.personId=Address.personId;<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5de6\u8054\u7ed3<\/p>\n","protected":false},"author":1,"featured_media":7932,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/7931"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=7931"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/7931\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/7932"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=7931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=7931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=7931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}