{"id":4068,"date":"2023-11-04T11:15:26","date_gmt":"2023-11-04T03:15:26","guid":{"rendered":"https:\/\/white-night.club\/?p=4068"},"modified":"2023-11-09T11:07:43","modified_gmt":"2023-11-09T03:07:43","slug":"ad126","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/04\/ad126\/","title":{"rendered":"1978.\u00a0\u4e0a\u7ea7\u7ecf\u7406\u5df2\u79bb\u804c\u7684\u516c\u53f8\u5458\u5de5"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Employees<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+----------+\n| Column Name | Type     |\n+-------------+----------+\n| employee_id | int      |\n| name        | varchar  |\n| manager_id  | int      |\n| salary      | int      |\n+-------------+----------+\n\u5728 SQL \u4e2d\uff0cemployee_id \u662f\u8fd9\u4e2a\u8868\u7684\u4e3b\u952e\u3002\n\u8fd9\u4e2a\u8868\u5305\u542b\u4e86\u5458\u5de5\uff0c\u4ed6\u4eec\u7684\u85aa\u6c34\u548c\u4e0a\u7ea7\u7ecf\u7406\u7684id\u3002\n\u6709\u4e00\u4e9b\u5458\u5de5\u6ca1\u6709\u4e0a\u7ea7\u7ecf\u7406\uff08\u5176 manager_id \u662f\u7a7a\u503c\uff09\u3002\n<\/pre>\n\n\n\n<p>\u67e5\u627e\u8fd9\u4e9b\u5458\u5de5\u7684id\uff0c\u4ed6\u4eec\u7684\u85aa\u6c34\u4e25\u683c\u5c11\u4e8e<code>$30000<\/code>&nbsp;\u5e76\u4e14\u4ed6\u4eec\u7684\u4e0a\u7ea7\u7ecf\u7406\u5df2\u79bb\u804c\u3002\u5f53\u4e00\u4e2a\u7ecf\u7406\u79bb\u5f00\u516c\u53f8\u65f6\uff0c\u4ed6\u4eec\u7684\u4fe1\u606f\u9700\u8981\u4ece\u5458\u5de5\u8868\u4e2d\u5220\u9664\u6389\uff0c\u4f46\u662f\u8868\u4e2d\u7684\u5458\u5de5\u7684<code>manager_id<\/code>&nbsp;&nbsp;\u8fd9\u4e00\u5217\u8fd8\u662f\u8bbe\u7f6e\u7684\u79bb\u804c\u7ecf\u7406\u7684id&nbsp;\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u7684\u7ed3\u679c\u6309\u7167<code>employee_id&nbsp;<\/code>\u4ece\u5c0f\u5230\u5927\u6392\u5e8f\u3002<\/p>\n\n\n\n<p>\u67e5\u8be2\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>\nEmployees table:\n+-------------+-----------+------------+--------+\n| employee_id | name      | manager_id | salary |\n+-------------+-----------+------------+--------+\n| 3           | Mila      | 9          | 60301  |\n| 12          | Antonella | null       | 31000  |\n| 13          | Emery     | null       | 67084  |\n| 1           | Kalel     | 11         | 21241  |\n| 9           | Mikaela   | null       | 50937  |\n| 11          | Joziah    | 6          | 28485  |\n+-------------+-----------+------------+--------+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+-------------+\n| employee_id |\n+-------------+\n| 11          |\n+-------------+\n\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u85aa\u6c34\u5c11\u4e8e 30000 \u7f8e\u5143\u7684\u5458\u5de5\u6709 1 \u53f7(Kalel) \u548c 11\u53f7 (Joziah)\u3002\nKalel \u7684\u4e0a\u7ea7\u7ecf\u7406\u662f 11 \u53f7\u5458\u5de5\uff0c\u4ed6\u8fd8\u5728\u516c\u53f8\u4e0a\u73ed(\u4ed6\u662f Joziah )\u3002\nJoziah \u7684\u4e0a\u7ea7\u7ecf\u7406\u662f 6 \u53f7\u5458\u5de5\uff0c\u4ed6\u5df2\u7ecf\u79bb\u804c\uff0c\u56e0\u4e3a\u5458\u5de5\u8868\u91cc\u9762\u5df2\u7ecf\u6ca1\u6709 6 \u53f7\u5458\u5de5\u7684\u4fe1\u606f\u4e86\uff0c\u5b83\u88ab\u5220\u9664\u4e86\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>\u6478\u9c7c\u9898<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u554a\uff0c\u554a\uff1f\u554a\u3002\u55ef\uff0c\u5b50\u67e5\u8be2\u5b8c\u4e8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT A.employee_id\r\nFROM Employees AS A \r\nWHERE A.salary&lt;30000 AND NOT EXISTS(\r\n  SELECT B.employee_id\r\n  FROM Employees AS B \r\n  WHERE A.manager_id=B.employee_id OR A.manager_id IS NULL\r\n)\r\nORDER BY A.employee_id ASC<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u6478\u9c7c\u9898<\/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\/4068"}],"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=4068"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4068\/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=4068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=4068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=4068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}