{"id":3147,"date":"2023-10-20T10:56:41","date_gmt":"2023-10-20T02:56:41","guid":{"rendered":"https:\/\/white-night.club\/?p=3147"},"modified":"2023-11-09T11:07:47","modified_gmt":"2023-11-09T03:07:47","slug":"ad78","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/20\/ad78\/","title":{"rendered":"178.&nbsp;\u5206\u6570\u6392\u540d"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Scores<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| id          | int     |\n| score       | decimal |\n+-------------+---------+\n\u5728 SQL \u4e2d\uff0cid \u662f\u8be5\u8868\u7684\u4e3b\u952e\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u5305\u542b\u4e86\u4e00\u573a\u6bd4\u8d5b\u7684\u5206\u6570\u3002Score \u662f\u4e00\u4e2a\u6709\u4e24\u4f4d\u5c0f\u6570\u70b9\u7684\u6d6e\u70b9\u503c\u3002\n<\/pre>\n\n\n\n<p>\u67e5\u8be2\u5e76\u5bf9\u5206\u6570\u8fdb\u884c\u6392\u5e8f\u3002\u6392\u540d\u6309\u4ee5\u4e0b\u89c4\u5219\u8ba1\u7b97:<\/p>\n\n\n\n<ul>\n<li>\u5206\u6570\u5e94\u6309\u4ece\u9ad8\u5230\u4f4e\u6392\u5217\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4e24\u4e2a\u5206\u6570\u76f8\u7b49\uff0c\u90a3\u4e48\u4e24\u4e2a\u5206\u6570\u7684\u6392\u540d\u5e94\u8be5\u76f8\u540c\u3002<\/li>\n\n\n\n<li>\u5728\u6392\u540d\u76f8\u540c\u7684\u5206\u6570\u540e\uff0c\u6392\u540d\u6570\u5e94\u8be5\u662f\u4e0b\u4e00\u4e2a\u8fde\u7eed\u7684\u6574\u6570\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u6392\u540d\u4e4b\u95f4\u4e0d\u5e94\u8be5\u6709\u7a7a\u7f3a\u7684\u6570\u5b57\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u6309&nbsp;<code>score<\/code>&nbsp;\u964d\u5e8f\u8fd4\u56de\u7ed3\u679c\u8868\u3002<\/p>\n\n\n\n<p>\u67e5\u8be2\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> \nScores \u8868:\n+----+-------+\n| id | score |\n+----+-------+\n| 1  | 3.50  |\n| 2  | 3.65  |\n| 3  | 4.00  |\n| 4  | 3.85  |\n| 5  | 4.00  |\n| 6  | 3.65  |\n+----+-------+\n<strong>\u8f93\u51fa:<\/strong> \n+-------+------+\n| score | rank |\n+-------+------+\n| 4.00  | 1    |\n| 4.00  | 1    |\n| 3.85  | 2    |\n| 3.65  | 3    |\n| 3.65  | 3    |\n| 3.50  | 4    |\n+-------+------+<\/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>\u7a97\u53e3\u51fd\u6570<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u6700\u8fd1\u5728\u5b66\u7a97\u53e3\u51fd\u6570\uff0c\u8fd9\u4e1c\u897f\u662f\u4e0d\u662f\u6709\u70b9\u8fc7\u4e8e\u597d\u7528\u4e86&#8230;\u4e2d\u7b49\u9898\u7a97\u53e3\u51fd\u6570\u76f4\u63a5\u5c31\u641e\u5b9a\u4e86\uff0c\u53ef\u60dc\u7a97\u53e3\u51fd\u6570\u53ea\u6709mysql8.0\u4e4b\u540e\u624d\u80fd\u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT score,\r\ndense_rank()over(ORDER BY score desc) AS \"rank\"\r\nFROM Scores<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u7a97\u53e3\u51fd\u6570<\/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\/3147"}],"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=3147"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3147\/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=3147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}