{"id":2186,"date":"2023-10-09T16:08:29","date_gmt":"2023-10-09T08:08:29","guid":{"rendered":"https:\/\/white-night.club\/?p=2186"},"modified":"2023-11-09T11:07:51","modified_gmt":"2023-11-09T03:07:51","slug":"ad33","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/09\/ad33\/","title":{"rendered":"607.\u00a0\u9500\u552e\u5458"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>SalesPerson<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-----------------+---------+\n| Column Name     | Type    |\n+-----------------+---------+\n| sales_id        | int     |\n| name            | varchar |\n| salary          | int     |\n| commission_rate | int     |\n| hire_date       | date    |\n+-----------------+---------+\nsales_id \u662f\u8be5\u8868\u7684\u4e3b\u952e\u5217(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217)\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u663e\u793a\u4e86\u9500\u552e\u4eba\u5458\u7684\u59d3\u540d\u548c ID \uff0c\u4ee5\u53ca\u4ed6\u4eec\u7684\u5de5\u8d44\u3001\u4f63\u91d1\u7387\u548c\u96c7\u4f63\u65e5\u671f\u3002\n<\/pre>\n\n\n\n<p>\u8868:&nbsp;<code>Company<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| com_id      | int     |\n| name        | varchar |\n| city        | varchar |\n+-------------+---------+\ncom_id \u662f\u8be5\u8868\u7684\u4e3b\u952e\u5217(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217)\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u8868\u793a\u516c\u53f8\u7684\u540d\u79f0\u548c ID \uff0c\u4ee5\u53ca\u516c\u53f8\u6240\u5728\u7684\u57ce\u5e02\u3002\n<\/pre>\n\n\n\n<p>\u8868:&nbsp;<code>Orders<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| order_id    | int  |\n| order_date  | date |\n| com_id      | int  |\n| sales_id    | int  |\n| amount      | int  |\n+-------------+------+\norder_id \u662f\u8be5\u8868\u7684\u4e3b\u952e\u5217(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217)\u3002\ncom_id \u662f Company \u8868\u4e2d com_id \u7684\u5916\u952e\uff08reference \u5217\uff09\u3002\nsales_id \u662f\u6765\u81ea\u9500\u552e\u5458\u8868 sales_id \u7684\u5916\u952e\uff08reference \u5217\uff09\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u8ba2\u5355\u7684\u4fe1\u606f\u3002\u8fd9\u5305\u62ec\u516c\u53f8\u7684 ID \u3001\u9500\u552e\u4eba\u5458\u7684 ID \u3001\u8ba2\u5355\u65e5\u671f\u548c\u652f\u4ed8\u7684\u91d1\u989d\u3002\n<\/pre>\n\n\n\n<p>\u7f16\u5199\u89e3\u51b3\u65b9\u6848\uff0c\u627e\u51fa\u6ca1\u6709\u4efb\u4f55\u4e0e\u540d\u4e3a&nbsp;<strong>\u201cRED\u201d<\/strong>&nbsp;\u7684\u516c\u53f8\u76f8\u5173\u7684\u8ba2\u5355\u7684\u6240\u6709\u9500\u552e\u4eba\u5458\u7684\u59d3\u540d\u3002<\/p>\n\n\n\n<p>\u4ee5&nbsp;<strong>\u4efb\u610f\u987a\u5e8f<\/strong>&nbsp;\u8fd4\u56de\u7ed3\u679c\u8868\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>\nSalesPerson \u8868:\n+----------+------+--------+-----------------+------------+\n| sales_id | name | salary | commission_rate | hire_date  |\n+----------+------+--------+-----------------+------------+\n| 1        | John | 100000 | 6               | 4\/1\/2006   |\n| 2        | Amy  | 12000  | 5               | 5\/1\/2010   |\n| 3        | Mark | 65000  | 12              | 12\/25\/2008 |\n| 4        | Pam  | 25000  | 25              | 1\/1\/2005   |\n| 5        | Alex | 5000   | 10              | 2\/3\/2007   |\n+----------+------+--------+-----------------+------------+\nCompany \u8868:\n+--------+--------+----------+\n| com_id | name   | city     |\n+--------+--------+----------+\n| 1      | RED    | Boston   |\n| 2      | ORANGE | New York |\n| 3      | YELLOW | Boston   |\n| 4      | GREEN  | Austin   |\n+--------+--------+----------+\nOrders \u8868:\n+----------+------------+--------+----------+--------+\n| order_id | order_date | com_id | sales_id | amount |\n+----------+------------+--------+----------+--------+\n| 1        | 1\/1\/2014   | 3      | 4        | 10000  |\n| 2        | 2\/1\/2014   | 4      | 5        | 5000   |\n| 3        | 3\/1\/2014   | 1      | 1        | 50000  |\n| 4        | 4\/1\/2014   | 1      | 4        | 25000  |\n+----------+------------+--------+----------+--------+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+------+\n| name |\n+------+\n| Amy  |\n| Mark |\n| Alex |\n+------+\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u6839\u636e\u8868&nbsp;<code>orders<\/code>&nbsp;\u4e2d\u7684\u8ba2\u5355 '3' \u548c '4' \uff0c\u5bb9\u6613\u770b\u51fa\u53ea\u6709 'John' \u548c 'Pam' \u4e24\u4e2a\u9500\u552e\u5458\u66fe\u7ecf\u5411\u516c\u53f8 'RED' \u9500\u552e\u8fc7\u3002\n\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8f93\u51fa\u8868&nbsp;<code>salesperson<\/code>&nbsp;\u4e2d\u6240\u6709\u5176\u4ed6\u4eba\u7684\u540d\u5b57\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>\u4e09\u8868\u67e5\u8be2<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u4ece\u4e09\u4e2a\u8868\u4e2d\u67e5\u6570\u636e\uff0c\u5176\u5b9e\u548c\u4e24\u4e2a\u8868\u6ca1\u592a\u5927\u5dee\u522b\uff0c\u591a\u52a0\u51e0\u4e2a\u5224\u65ad\u6761\u4ef6\u800c\u8a00\u3002\u867d\u7136\u4e3a\u4e86\u7701\u4e8b\u6240\u4ee5\u7528\u4e86\u201dCompany.*\u201c\uff0c\u4f46\u4e2a\u4eba\u611f\u89c9\u4f1a\u5f71\u54cd\u6548\u7387\u3002<\/p>\n\n\n\n<p>\u4e3b\u8981\u8fd8\u662f\u522b\u540d\u7684\u7528\u6cd5\u5427\uff0c\u6bd5\u7adf\u522b\u540d\u5e94\u8be5\u7b97\u662f\u6bd4\u8f83\u5e38\u7528\u7684\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT A.name\r\nFROM SalesPerson AS A\r\nWHERE NOT EXISTS(\r\n    SELECT Company.*,Orders.*\r\n    FROM Company,Orders\r\n    WHERE A.sales_id=Orders.sales_id\r\n    AND Orders.com_id=Company.com_id\r\n    AND Company.name=\"RED\"\r\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode:\u4e09\u8868\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\/2186"}],"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=2186"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2186\/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=2186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}