{"id":3749,"date":"2023-10-29T13:08:50","date_gmt":"2023-10-29T05:08:50","guid":{"rendered":"https:\/\/white-night.club\/?p=3749"},"modified":"2023-11-09T11:07:45","modified_gmt":"2023-11-09T03:07:45","slug":"ad109","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/29\/ad109\/","title":{"rendered":"2504.\u00a0\u628a\u540d\u5b57\u548c\u804c\u4e1a\u8054\u7cfb\u8d77\u6765"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Person<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| person_id   | int     |\n| name        | varchar |\n| profession  | ENUM    |\n+-------------+---------+\n<code>person_id<\/code> \u662f\u8be5\u8868\u7684\u4e3b\u952e\uff08\u5177\u6709\u552f\u4e00\u503c\u7684\u5217\uff09\u3002\n\u8be5\u8868\u4e2d\u7684\u6bcf\u4e00\u884c\u90fd\u5305\u542b\u4e00\u4e2a\u4eba\u7684 ID\u3001\u59d3\u540d\u548c\u804c\u4e1a\u3002\nprofession \u662f ENUM \u7c7b\u578b\uff0c\u5176\u503c\u4e3a ('Doctor', 'Singer', 'Actor', 'Player', 'Engineer', 'Lawyer') \u4e4b\u4e00\u3002\n<\/pre>\n\n\n\n<p>\u7f16\u5199\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u62a5\u544a\u6bcf\u4e2a\u4eba\u7684\u540d\u5b57\uff0c\u540e\u9762\u662f\u4ed6\u4eec\u804c\u4e1a\u7684\u7b2c\u4e00\u4e2a\u5b57\u6bcd\uff0c\u7528\u62ec\u53f7\u62ec\u8d77\u6765\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u6309&nbsp;<code>person_id<\/code>&nbsp;<strong>\u964d\u5e8f\u6392\u5217&nbsp;<\/strong>\u7684\u7ed3\u679c\u8868\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u7ed3\u679c\u683c\u5f0f\u793a\u4f8b\u5982\u4e0b\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> \nPerson \u8868:\n+-----------+-------+------------+\n| person_id | name  | profession |\n+-----------+-------+------------+\n| 1         | Alex  | Singer     |\n| 3         | Alice | Actor      |\n| 2         | Bob   | Player     |\n| 4         | Messi | Doctor     |\n| 6         | Tyson | Engineer   |\n| 5         | Meir  | Lawyer     |\n+-----------+-------+------------+\n<strong>\u8f93\u51fa:<\/strong> \n+-----------+----------+\n| person_id | name     |\n+-----------+----------+\n| 6         | Tyson(E) |\n| 5         | Meir(L)  |\n| 4         | Messi(D) |\n| 3         | Alice(A) |\n| 2         | Bob(P)   |\n| 1         | Alex(S)  |\n+-----------+----------+\n<strong>\u89e3\u91ca:<\/strong> \u8bf7\u6ce8\u610f\uff0c\u5728\u540d\u79f0\u548c\u804c\u4e1a\u7684\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u4e4b\u95f4\u4e0d\u5e94\u8be5\u6709\u4efb\u4f55\u7a7a\u767d\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>SubString+CONCAT<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5b66\u4e60\u4e0b\u8fd9\u4e24\u4e2a\u51fd\u6570\u7684\u7528\u6cd5\u3002\u4e4b\u524d\u7528\u8fc7GROUP_CONCAT\u3002CONCAT\u548cGROUP_CONCAT\u90fd\u53ef\u4ee5\u5408\u5e76\u591a\u4e2a\u5b57\u7b26\u4e32\/\u5217\u3002SubString\u7684\u8bdd\u5c31\u662f\u4ece\u5355\u4e2a\u5b57\u7b26\u4e32\u4e2d\u53d6n\u4e2a\u5b57\u7b26\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT person_id,CONCAT(name,'(',SUBSTRING(profession,1,1),')') AS name\r\nFROM Person \r\nORDER BY person_id DESC<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aSubString\u548cCONCAT<\/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\/3749"}],"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=3749"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3749\/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=3749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}