{"id":2435,"date":"2023-10-13T10:47:46","date_gmt":"2023-10-13T02:47:46","guid":{"rendered":"https:\/\/white-night.club\/?p=2435"},"modified":"2023-11-09T11:07:50","modified_gmt":"2023-11-09T03:07:50","slug":"ad44","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/13\/ad44\/","title":{"rendered":"1045.\u00a0\u4e70\u4e0b\u6240\u6709\u4ea7\u54c1\u7684\u5ba2\u6237"},"content":{"rendered":"\n<p><code>Customer<\/code>&nbsp;\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| customer_id | int     |\n| product_key | int     |\n+-------------+---------+\n\u8be5\u8868\u53ef\u80fd\u5305\u542b\u91cd\u590d\u7684\u884c\u3002\ncustomer_id \u4e0d\u4e3a NULL\u3002\nproduct_key \u662f Product \u8868\u7684\u5916\u952e(reference \u5217)\u3002\n<\/pre>\n\n\n\n<p><code>Product<\/code>&nbsp;\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| product_key | int     |\n+-------------+---------+\nproduct_key \u662f\u8fd9\u5f20\u8868\u7684\u4e3b\u952e\uff08\u5177\u6709\u552f\u4e00\u503c\u7684\u5217\uff09\u3002\n<\/pre>\n\n\n\n<p>\u7f16\u5199\u89e3\u51b3\u65b9\u6848\uff0c\u62a5\u544a&nbsp;<code>Customer<\/code>&nbsp;\u8868\u4e2d\u8d2d\u4e70\u4e86&nbsp;<code>Product<\/code>&nbsp;\u8868\u4e2d\u6240\u6709\u4ea7\u54c1\u7684\u5ba2\u6237\u7684 id\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u7ed3\u679c\u8868&nbsp;<strong>\u65e0\u987a\u5e8f\u8981\u6c42<\/strong>&nbsp;\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u7ed3\u679c\u683c\u5f0f\u5982\u4e0b\u6240\u793a\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>\nCustomer \u8868\uff1a\n+-------------+-------------+\n| customer_id | product_key |\n+-------------+-------------+\n| 1           | 5           |\n| 2           | 6           |\n| 3           | 5           |\n| 3           | 6           |\n| 1           | 6           |\n+-------------+-------------+\nProduct \u8868\uff1a\n+-------------+\n| product_key |\n+-------------+\n| 5           |\n| 6           |\n+-------------+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+-------------+\n| customer_id |\n+-------------+\n| 1           |\n| 3           |\n+-------------+\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u8d2d\u4e70\u4e86\u6240\u6709\u4ea7\u54c1\uff085 \u548c 6\uff09\u7684\u5ba2\u6237\u7684 id \u662f 1 \u548c 3 \u3002<\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u76f8\u5173\u5b50\u67e5\u8be2<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u8be6\u89e3\u5728<a href=\"https:\/\/white-night.club\/index.php\/2023\/10\/12\/db5\/\" data-type=\"URL\" data-id=\"https:\/\/white-night.club\/index.php\/2023\/10\/12\/db5\/\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0086ff\" class=\"has-inline-color\">\u8fd9\u7bc7\u6587\u7ae0<\/mark><\/a>\u4e86\uff0c\u8fd9\u91cc\u76f4\u63a5\u653e\u4ee3\u7801\u5427\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT DISTINCT A.customer_id FROM (SELECT DISTINCT customer_id FROM Customer) AS A\r\nWHERE NOT EXISTS(\r\n    SELECT 1 FROM Product AS B\r\n    WHERE NOT EXISTS(\r\n        SELECT 1 FROM Customer AS C\r\n        WHERE A.customer_id=C.customer_id AND B.Product_key=C.Product_key\r\n    )    \r\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aNOT EXISTS\u76f8\u5173\u5b50\u67e5\u8be2<\/p>\n","protected":false},"author":1,"featured_media":2827,"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\/2435"}],"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=2435"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2435\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}