{"id":4121,"date":"2023-11-05T11:08:26","date_gmt":"2023-11-05T03:08:26","guid":{"rendered":"https:\/\/white-night.club\/?p=4121"},"modified":"2023-11-09T11:07:43","modified_gmt":"2023-11-09T03:07:43","slug":"ad128","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/05\/ad128\/","title":{"rendered":"2668.\u00a0\u67e5\u8be2\u5458\u5de5\u5f53\u524d\u85aa\u6c34"},"content":{"rendered":"\n<p>\u8868\uff1a<code>Salary<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+---------------+---------+ \n| \u5217\u540d          | \u7c7b\u578b    | \n+---------------+---------+ \n| emp_id        | int     | \n| firstname     | varchar |\n| lastname      | varchar |\n| salary        | varchar |\n| department_id | varchar |\n+---------------+---------+\n(emp_id, salary) \u662f\u8be5\u8868\u7684\u4e3b\u952e(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217\u7684\u7ec4\u5408)\u3002\n\u6bcf\u884c\u5305\u542b\u5458\u5de5\u7684\u8be6\u7ec6\u4fe1\u606f\u548c\u4ed6\u4eec\u6bcf\u5e74\u7684\u85aa\u6c34\uff0c\u4f46\u6709\u4e9b\u8bb0\u5f55\u662f\u65e7\u7684\uff0c\u5305\u542b\u8fc7\u65f6\u7684\u85aa\u8d44\u4fe1\u606f\u3002\n<\/pre>\n\n\n\n<p>\u627e\u51fa\u6bcf\u4e2a\u5458\u5de5\u7684\u5f53\u524d\u85aa\u6c34\uff0c\u5047\u8bbe\u85aa\u6c34\u6bcf\u5e74\u589e\u52a0\u3002\u8f93\u51fa\u4ed6\u4eec\u7684&nbsp;<code>emp_id<\/code>&nbsp;\u3001<code>firstname<\/code>&nbsp;\u3001<code>lastname<\/code>&nbsp;\u3001<code>salary<\/code>&nbsp;\u548c&nbsp;<code>department_id<\/code>&nbsp;\u3002<\/p>\n\n\n\n<p>\u6309&nbsp;<code>emp_id<\/code>&nbsp;<strong>\u5347\u5e8f\u6392\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\n<\/strong><code>Salary<\/code> \u8868:\n+--------+-----------+----------+--------+---------------+\n| emp_id | firstname | lastname | salary | department_id |\n+--------+-----------+----------+--------+---------------+ \n| 1      | Todd      | Wilson   | 110000 | D1006         |\n| 1      | Todd      | Wilson   | 106119 | D1006         | \n| 2      | Justin    | Simon    | 128922 | D1005         | \n| 2      | Justin    | Simon    | 130000 | D1005         | \n| 3      | Kelly     | Rosario  | 42689  | D1002         | \n| 4      | Patricia  | Powell   | 162825 | D1004         |\n| 4      | Patricia  | Powell   | 170000 | D1004         |\n| 5      | Sherry    | Golden   | 44101  | D1002         | \n| 6      | Natasha   | Swanson  | 79632  | D1005         | \n| 6      | Natasha   | Swanson  | 90000  | D1005         |\n+--------+-----------+----------+--------+---------------+\n<strong>\u8f93\u51fa\uff1a\n<\/strong>+--------+-----------+----------+--------+---------------+\n| emp_id | firstname | lastname | salary | department_id |\n+--------+-----------+----------+--------+---------------+ \n| 1      | Todd      | Wilson   | 110000 | D1006         |\n| 2      | Justin    | Simon    | 130000 | D1005         | \n| 3      | Kelly     | Rosario  | 42689  | D1002         | \n| 4      | Patricia  | Powell   | 170000 | D1004         |\n| 5      | Sherry    | Golden   | 44101  | D1002         | \n| 6      | Natasha   | Swanson  | 90000  | D1005         |\n+--------+-----------+----------+--------+---------------+<strong>\n<\/strong>\n<strong>\u89e3\u91ca\uff1a<\/strong>\n- emp_id 1 \u6709\u4e24\u6761\u8bb0\u5f55\uff0c\u5de5\u8d44\u5206\u522b\u4e3a 110000 \u548c 106119\uff0c\u5176\u4e2d 110000 \u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\uff08\u5047\u8bbe\u5de5\u8d44\u6bcf\u5e74\u90fd\u4f1a\u589e\u52a0\uff09\n- emp_id 2 \u6709\u4e24\u6761\u8bb0\u5f55\uff0c\u5de5\u8d44\u5206\u522b\u4e3a 128922 \u548c 130000\uff0c\u5176\u4e2d 130000 \u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\u3002\n- emp_id 3 \u53ea\u6709\u4e00\u6761\u5de5\u8d44\u8bb0\u5f55\uff0c\u56e0\u6b64\u8fd9\u5df2\u7ecf\u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\u3002\n- emp_id 4 \u6709\u4e24\u6761\u8bb0\u5f55\uff0c\u5de5\u8d44\u5206\u522b\u4e3a 162825 \u548c 170000\uff0c\u5176\u4e2d 170000 \u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\u3002\n- emp_id 5 \u53ea\u6709\u4e00\u6761\u5de5\u8d44\u8bb0\u5f55\uff0c\u56e0\u6b64\u8fd9\u5df2\u7ecf\u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\u3002\n- emp_id 6 \u6709\u4e24\u6761\u8bb0\u5f55\uff0c\u5de5\u8d44\u5206\u522b\u4e3a 79632 \u548c 90000\uff0c\u5176\u4e2d 90000 \u662f\u66f4\u65b0\u540e\u7684\u5de5\u8d44\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>\u4e00\u5f00\u59cb\u7528\u9519\u7528\u4e86having\u3002\u5e94\u8be5\u7528where\u624d\u5bf9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT A.*\r\nFROM Salary AS A\r\nWHERE A.salary >=(\r\n  SELECT MAX(B.salary)\r\n  FROM Salary AS B \r\n  WHERE A.emp_id=B.emp_id\r\n)\r\nGROUP BY A.emp_id\r\nORDER BY A.emp_id ASC\r\n<\/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\/4121"}],"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=4121"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4121\/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=4121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=4121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=4121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}