{"id":3270,"date":"2023-10-24T12:18:38","date_gmt":"2023-10-24T04:18:38","guid":{"rendered":"https:\/\/white-night.club\/?p=3270"},"modified":"2023-11-09T11:07:46","modified_gmt":"2023-11-09T03:07:46","slug":"ad91","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/24\/ad91\/","title":{"rendered":"1076.\u00a0\u9879\u76ee\u5458\u5de5II"},"content":{"rendered":"\n<p>\u8868\uff1a<code>Project<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| project_id  | int     |\n| employee_id | int     |\n+-------------+---------+\n(project_id, employee_id) \u662f\u8be5\u8868\u7684\u4e3b\u952e(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217\u7684\u7ec4\u5408)\u3002\nemployee_id \u662f\u8be5\u8868\u7684\u5916\u952e(reference \u5217)\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u8868\u660e employee_id \u7684\u96c7\u5458\u6b63\u5728\u5904\u7406 Project \u8868\u4e2d project_id \u7684\u9879\u76ee\u3002\n<\/pre>\n\n\n\n<p>\u8868\uff1a<code>Employee<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+------------------+---------+\n| Column Name      | Type    |\n+------------------+---------+\n| employee_id      | int     |\n| name             | varchar |\n| experience_years | int     |\n+------------------+---------+\nemployee_id \u662f\u8be5\u8868\u7684\u4e3b\u952e(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217)\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u5305\u542b\u4e00\u540d\u96c7\u5458\u7684\u4fe1\u606f\u3002<\/pre>\n\n\n\n<p>\u7f16\u5199\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u6765\u62a5\u544a\u6240\u6709\u62e5\u6709\u6700\u591a\u5458\u5de5\u7684&nbsp;<strong>\u9879\u76ee<\/strong>\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>\nProject table:\n+-------------+-------------+\n| project_id  | employee_id |\n+-------------+-------------+\n| 1           | 1           |\n| 1           | 2           |\n| 1           | 3           |\n| 2           | 1           |\n| 2           | 4           |\n+-------------+-------------+\nEmployee table:\n+-------------+--------+------------------+\n| employee_id | name   | experience_years |\n+-------------+--------+------------------+\n| 1           | Khaled | 3                |\n| 2           | Ali    | 2                |\n| 3           | John   | 1                |\n| 4           | Doe    | 2                |\n+-------------+--------+------------------+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+-------------+\n| project_id  |\n+-------------+\n| 1           |\n+-------------+\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u7b2c\u4e00\u4e2a\u9879\u76ee\u67093\u540d\u5458\u5de5\uff0c\u7b2c\u4e8c\u4e2a\u9879\u76ee\u67092\u540d\u5458\u5de5\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>LIMIT 1<\/em><\/cite><\/blockquote>\n\n\n\n<p>COUNT()=(SELECT&#8230;)\uff0c\u6700\u540e\u53ea\u80fd\u8fd4\u56de\u4e00\u6761\u8bb0\u5f55\u624d\u80fd\u4f5c\u5927\u5c0f\u5224\u65ad\uff0c\u6240\u4ee5\u5f97LIMIT\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT project_id FROM Project \r\nGROUP BY project_id\r\nHAVING COUNT(employee_id)=(\r\n  SELECT COUNT(employee_id)\r\n  FROM Project \r\n  GROUP BY project_id\r\n  ORDER BY COUNT(employee_id) DESC\r\n  LIMIT 1\r\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aLimit 1<\/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\/3270"}],"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=3270"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3270\/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=3270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}