{"id":3799,"date":"2023-10-31T11:14:54","date_gmt":"2023-10-31T03:14:54","guid":{"rendered":"https:\/\/white-night.club\/?p=3799"},"modified":"2023-11-09T11:07:44","modified_gmt":"2023-11-09T03:07:44","slug":"ad115","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/31\/ad115\/","title":{"rendered":"574.\u00a0\u5f53\u9009\u8005"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Candidate<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+----------+\n| Column Name | Type     |\n+-------------+----------+\n| id          | int      |\n| name        | varchar  |\n+-------------+----------+\nid \u662f\u8be5\u8868\u4e2d\u5177\u6709\u552f\u4e00\u503c\u7684\u5217\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u5305\u542b\u5173\u4e8e\u5019\u9009\u5bf9\u8c61\u7684id\u548c\u540d\u79f0\u7684\u4fe1\u606f\u3002<\/pre>\n\n\n\n<p>\u8868:&nbsp;<code>Vote<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| id          | int  |\n| candidateId | int  |\n+-------------+------+\nid \u662f\u81ea\u52a8\u9012\u589e\u7684\u4e3b\u952e(\u5177\u6709\u552f\u4e00\u503c\u7684\u5217)\u3002\ncandidateId\u662fid\u6765\u81eaCandidate\u8868\u7684\u5916\u952e(reference \u5217)\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u51b3\u5b9a\u4e86\u5728\u9009\u4e3e\u4e2d\u83b7\u5f97\u7b2ci\u5f20\u9009\u7968\u7684\u5019\u9009\u4eba\u3002<\/pre>\n\n\n\n<p>\u7f16\u5199\u89e3\u51b3\u65b9\u6848\u6765\u62a5\u544a\u83b7\u80dc\u5019\u9009\u4eba\u7684\u540d\u5b57(\u5373\u83b7\u5f97\u6700\u591a\u9009\u7968\u7684\u5019\u9009\u4eba)\u3002<\/p>\n\n\n\n<p>\u751f\u6210\u7684\u6d4b\u8bd5\u7528\u4f8b\u4fdd\u8bc1&nbsp;<strong>\u53ea\u6709\u4e00\u4e2a\u5019\u9009\u4eba\u8d62\u5f97&nbsp;<\/strong>\u9009\u4e3e\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:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> \nCandidate table:\n+----+------+\n| id | name |\n+----+------+\n| 1  | A    |\n| 2  | B    |\n| 3  | C    |\n| 4  | D    |\n| 5  | E    |\n+----+------+\nVote table:\n+----+-------------+\n| id | candidateId |\n+----+-------------+\n| 1  | 2           |\n| 2  | 4           |\n| 3  | 3           |\n| 4  | 2           |\n| 5  | 5           |\n+----+-------------+\n<strong>\u8f93\u51fa:<\/strong> \n+------+\n| name |\n+------+\n| B    |\n+------+\n<strong>\u89e3\u91ca:<\/strong> \n\u5019\u9009\u4ebaB\u67092\u7968\u3002\u5019\u9009\u4ebaC\u3001D\u3001E\u5404\u67091\u7968\u3002\n\u83b7\u80dc\u8005\u662f\u5019\u9009\u4ebaB\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>\u5de6\u8054\u7ed3<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u4e0d\u50cf\u4e2d\u7b49\u9898\u7684\u4e2d\u7b49\u9898\u3002\u81ea\u4ece\u6709\u4e86all\u4e4b\u540e\u8fd9\u79cd\u6bd4\u8f83xxx\u6700\u5927\u503c\u7684\u6211\u90fd\u76f4\u63a5\u7528all\u4e86\uff0c\u5927\u4e8e\u6700\u5c0f\u503c\u7684\u76f4\u63a5\u7528any\u3002\u8fd9\u9898\u5de6\u8054\u7ed3\u540e\u518dALL\u6bd4\u8f83\u4e00\u4e0b\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT A.name\r\nFROM Candidate AS A\r\nLEFT JOIN Vote AS B\r\nON A.id=B.candidateId\r\nGROUP BY B.candidateId\r\nHAVING COUNT(B.candidateId)>= ALL(\r\n  SELECT COUNT(candidateId)\r\n  FROM Vote\r\n  GROUP BY candidateId\r\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u5de6\u8054\u7ed3<\/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\/3799"}],"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=3799"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3799\/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=3799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}