{"id":2561,"date":"2023-10-14T14:23:45","date_gmt":"2023-10-14T06:23:45","guid":{"rendered":"https:\/\/white-night.club\/?p=2561"},"modified":"2023-11-09T11:07:50","modified_gmt":"2023-11-09T03:07:50","slug":"ad49","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/14\/ad49\/","title":{"rendered":"619.\u00a0\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6700\u5927\u6570\u5b57"},"content":{"rendered":"\n<p><code>MyNumbers<\/code>&nbsp;\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| num         | int  |\n+-------------+------+\n\u8be5\u8868\u53ef\u80fd\u5305\u542b\u91cd\u590d\u9879\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c\u5728SQL\u4e2d\uff0c\u8be5\u8868\u6ca1\u6709\u4e3b\u952e\uff09\u3002\n\u8fd9\u5f20\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u542b\u6709\u4e00\u4e2a\u6574\u6570\u3002\n<\/pre>\n\n\n\n<p><strong>\u5355\u4e00\u6570\u5b57<\/strong>&nbsp;\u662f\u5728&nbsp;<code>MyNumbers<\/code>&nbsp;\u8868\u4e2d\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6570\u5b57\u3002<\/p>\n\n\n\n<p>\u627e\u51fa\u6700\u5927\u7684&nbsp;<strong>\u5355\u4e00\u6570\u5b57<\/strong>&nbsp;\u3002\u5982\u679c\u4e0d\u5b58\u5728&nbsp;<strong>\u5355\u4e00\u6570\u5b57<\/strong>&nbsp;\uff0c\u5219\u8fd4\u56de&nbsp;<code>null<\/code>&nbsp;\u3002<\/p>\n\n\n\n<p>\u67e5\u8be2\u7ed3\u679c\u5982\u4e0b\u4f8b\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>\nMyNumbers \u8868\uff1a\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 3   |\n| 3   |\n| 1   |\n| 4   |\n| 5   |\n| 6   |\n+-----+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+-----+\n| num |\n+-----+\n| 6   |\n+-----+\n<strong>\u89e3\u91ca\uff1a<\/strong>\u5355\u4e00\u6570\u5b57\u6709 1\u30014\u30015 \u548c 6 \u3002\n6 \u662f\u6700\u5927\u7684\u5355\u4e00\u6570\u5b57\uff0c\u8fd4\u56de 6 \u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>\nMyNumbers table:\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 7   |\n| 7   |\n| 3   |\n| 3   |\n| 3   |\n+-----+\n<strong>\u8f93\u51fa\uff1a<\/strong>\n+------+\n| num  |\n+------+\n| null |\n+------+\n<strong>\u89e3\u91ca\uff1a<\/strong>\u8f93\u5165\u7684\u8868\u4e2d\u4e0d\u5b58\u5728\u5355\u4e00\u6570\u5b57\uff0c\u6240\u4ee5\u8fd4\u56de null \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>IFNULL\u7684\u7528\u6cd5<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u8fd9\u9898\u6709\u4e2a\u95ee\u9898\uff1a\u5982\u679c\u6ca1\u627e\u5230\u8981\u8fd4\u56denull\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u53ea\u662f\u5355\u7eaf\u7684SELECT\uff0c\u5f53\u627e\u4e0d\u5230\u5bf9\u5e94\u6570\u636e\u65f6\uff0c\u53ea\u4f1a\u8fd4\u56de\u7a7a\uff0c\u800c\u4e0d\u4f1a\u8fd4\u56deNULL\u3002\u6240\u4ee5\u8fd9\u91cc\u9700\u8981\u7528\u5230ifnull\u3002<\/p>\n\n\n\n<p>ifnull(A,B)\uff0c\u5982\u679c\u8868\u8fbe\u5f0fA\u4e3a\u7a7a\uff0c\u90a3\u4e48\u8fd4\u56deB\u3002\u53cd\u6b63\u5927\u81f4\u77e5\u9053\u80fd\u8fd9\u4e48\u7528\u5c31ok\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT IFNULL((\r\nSELECT num FROM MyNumbers\r\nGROUP BY num\r\nHAVING COUNT(*)=1\r\nORDER BY num DESC\r\nLIMIT 1\r\n),null) num<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aifnull<\/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\/2561"}],"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=2561"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2561\/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=2561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}