{"id":4648,"date":"2023-11-09T14:07:26","date_gmt":"2023-11-09T06:07:26","guid":{"rendered":"https:\/\/white-night.club\/?p=4648"},"modified":"2023-11-09T14:09:14","modified_gmt":"2023-11-09T06:09:14","slug":"ad141","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/09\/ad141\/","title":{"rendered":"2072.\u00a0\u8d62\u5f97\u6bd4\u8d5b\u7684\u5927\u5b66"},"content":{"rendered":"\n<p>\u8868\uff1a&nbsp;<code>NewYork<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| student_id  | int  |\n| score       | int  |\n+-------------+------+\n\u5728 SQL \u4e2d\uff0cstudent_id \u662f\u8fd9\u4e2a\u8868\u7684\u4e3b\u952e\u3002\n\u6bcf\u4e00\u884c\u5305\u542b\u7ebd\u7ea6\u5927\u5b66 (New York University) \u4e2d\u4e00\u540d\u5b66\u751f\u4e00\u6b21\u8003\u8bd5\u7684\u6210\u7ee9\u3002\n<\/pre>\n\n\n\n<p>\u8868\uff1a&nbsp;<code>California<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| student_id  | int  |\n| score       | int  |\n+-------------+------+\n\u5728 SQL \u4e2d\uff0cstudent_id \u662f\u8fd9\u4e2a\u8868\u7684\u4e3b\u952e\u3002\n\u6bcf\u4e00\u884c\u5305\u542b\u52a0\u5dde\u5927\u5b66 (California University) \u4e2d\u4e00\u540d\u5b66\u751f\u4e00\u6b21\u8003\u8bd5\u7684\u6210\u7ee9\u3002\n<\/pre>\n\n\n\n<p>\u7ebd\u7ea6\u5927\u5b66\u548c\u52a0\u5dde\u5927\u5b66\u4e4b\u95f4\u4e3e\u884c\u4e86\u4e00\u573a\u6bd4\u8d5b\u3002\u8fd9\u573a\u6bd4\u8d5b\u7531\u4e24\u6240\u5927\u5b66\u4e2d\u76f8\u540c\u6570\u91cf\u7684\u5b66\u751f\u53c2\u52a0\u3002\u62e5\u6709\u66f4\u591a<strong>\u4f18\u79c0\u5b66\u751f<\/strong>\u7684\u5927\u5b66\u8d62\u5f97\u8fd9\u573a\u6bd4\u8d5b\u3002\u5982\u679c\u4e24\u6240\u5927\u5b66\u7684<strong>\u4f18\u79c0\u5b66\u751f<\/strong>\u6570\u91cf\u76f8\u540c\uff0c\u5219\u8fd9\u573a\u6bd4\u8d5b\u5e73\u5c40\u3002<\/p>\n\n\n\n<p><strong>\u4f18\u79c0\u5b66\u751f<\/strong>\u662f\u6307\u5728\u8003\u8bd5\u4e2d\u83b7\u5f97&nbsp;<code>90%<\/code>&nbsp;\u6216\u66f4\u9ad8\u6210\u7ee9\u7684\u5b66\u751f\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>&#8220;New York University&#8221;<\/strong>&nbsp;\u82e5\u7ebd\u7ea6\u5927\u5b66\u8d62\u5f97\u8fd9\u573a\u6bd4\u8d5b\u3002<\/li>\n\n\n\n<li><strong>&#8220;California University&#8221;<\/strong>&nbsp;\u82e5\u52a0\u5dde\u5927\u5b66\u8d62\u5f97\u8fd9\u573a\u6bd4\u8d5b\u3002<\/li>\n\n\n\n<li><strong>&#8220;No Winner&#8221;<\/strong>&nbsp;\u82e5\u8fd9\u573a\u6bd4\u8d5b\u5e73\u5c40\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd4\u56de\u7ed3\u679c\u683c\u5f0f\u5982\u4e0b\u793a\u4f8b\u6240\u793a\uff1a<\/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> \nNewYork \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 1          | 90    |\n| 2          | 87    |\n+------------+-------+\nCalifornia \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 2          | 89    |\n| 3          | 88    |\n+------------+-------+\n<strong>\u8f93\u51fa:<\/strong> \n+---------------------+\n| winner              |\n+---------------------+\n| New York University |\n+---------------------+\n<strong>\u89e3\u91ca:<\/strong>\n\u7ebd\u7ea6\u5927\u5b66\u6709 1 \u540d\u4f18\u79c0\u5b66\u751f\uff0c\u52a0\u5dde\u5927\u5b66\u6709 0 \u540d\u4f18\u79c0\u5b66\u751f\u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> \nNewYork \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 1          | 89    |\n| 2          | 88    |\n+------------+-------+\nCalifornia \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 2          | 90    |\n| 3          | 87    |\n+------------+-------+\n<strong>\u8f93\u51fa:<\/strong> \n+-----------------------+\n| winner                |\n+-----------------------+\n| California University |\n+-----------------------+\n<strong>\u89e3\u91ca:<\/strong>\n\u7ebd\u7ea6\u5927\u5b66\u6709 0 \u540d\u4f18\u79c0\u5b66\u751f\uff0c\u52a0\u5dde\u5927\u5b66\u6709 1 \u540d\u4f18\u79c0\u5b66\u751f\u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 3:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> \nNewYork \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 1          | 89    |\n| 2          | 90    |\n+------------+-------+\nCalifornia \u8868:\n+------------+-------+\n| student_id | score |\n+------------+-------+\n| 2          | 87    |\n| 3          | 99    |\n+------------+-------+\n<strong>\u8f93\u51fa:<\/strong> \n+-----------+\n| winner    |\n+-----------+\n| No Winner |\n+-----------+\n<strong>\u89e3\u91ca:<\/strong>\n\u7ebd\u7ea6\u5927\u5b66\u548c\u52a0\u5dde\u5927\u5b66\u5747\u6709 1 \u540d\u4f18\u79c0\u5b66\u751f\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>CASE WHEN<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u76f4\u63a5CASE WHEN+COUNT(IF)\u79d2\u4e86\u3002\u672c\u6765\u60f3\u7528GROUP BY\u7684\uff0c\u4f46\u662f\u53d1\u73b0\u6ca1\u6709\u5fc5\u8981\u5206\u7ec4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT\r\nCASE\r\nWHEN COUNT(IF(A.score>=90,1,NULL))=COUNT(IF(B.score>=90,1,NULL)) THEN 'No Winner'\r\nWHEN COUNT(IF(A.score>=90,1,NULL))>COUNT(IF(B.score>=90,1,NULL)) THEN 'New York University'\r\nWHEN COUNT(IF(A.score>=90,1,NULL))&lt;COUNT(IF(B.score>=90,1,NULL)) THEN 'California University'\r\nEND AS winner\r\nFROM NewYork AS A,California AS B\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aCASE WHEN<\/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\/4648"}],"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=4648"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4648\/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=4648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=4648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=4648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}