{"id":1735,"date":"2025-02-16T09:07:34","date_gmt":"2025-02-16T01:07:34","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1735"},"modified":"2025-02-16T09:07:34","modified_gmt":"2025-02-16T01:07:34","slug":"sql-ucase-%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/16\/sql-ucase-%e5%87%bd%e6%95%b0\/","title":{"rendered":"SQL UCASE()\u00a0\u51fd\u6570 \u00a0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><code>UCASE()<\/code> \u662f SQL \u4e2d\u7684\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709\u5b57\u6bcd\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\u3002\u5b83\u662f SQL \u4e2d\u5904\u7406\u5927\u5c0f\u5199\u8f6c\u6362\u7684\u4e00\u79cd\u65b9\u6cd5\uff0c\u4e0e <code>UPPER()<\/code> \u51fd\u6570\u529f\u80fd\u76f8\u540c\uff0c\u5728\u67d0\u4e9b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\u53ef\u4ee5\u4e92\u6362\u4f7f\u7528\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong><code>UCASE()<\/code> \u7684\u57fa\u672c\u8bed\u6cd5<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT UCASE(column_name)\nFROM table_name;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>column_name<\/code>\uff1a\u4f60\u5e0c\u671b\u8f6c\u6362\u4e3a\u5927\u5199\u7684\u5217\u3002<\/li>\n\n\n\n<li><code>table_name<\/code>\uff1a\u5305\u542b\u8981\u64cd\u4f5c\u6570\u636e\u7684\u8868\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong><code>UCASE()<\/code> \u7684\u793a\u4f8b<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u540d\u4e3a <code>employees<\/code> \u7684\u8868\uff0c\u5305\u542b\u4ee5\u4e0b\u6570\u636e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>emp_id<\/th><th>emp_name<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Alice<\/td><\/tr><tr><td>2<\/td><td>Bob<\/td><\/tr><tr><td>3<\/td><td>Charlie<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u5e0c\u671b\u5c06 <code>emp_name<\/code> \u5217\u7684\u6240\u6709\u540d\u5b57\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT emp_id, UCASE(emp_name) AS emp_name_uppercase\nFROM employees;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u67e5\u8be2\u7ed3\u679c<\/strong>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>emp_id<\/th><th>emp_name_uppercase<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>ALICE<\/td><\/tr><tr><td>2<\/td><td>BOB<\/td><\/tr><tr><td>3<\/td><td>CHARLIE<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>\u4f7f\u7528 <code>UCASE()<\/code> \u8fdb\u884c\u6761\u4ef6\u8fc7\u6ee4<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u4e5f\u53ef\u4ee5\u7ed3\u5408 <code>UCASE()<\/code> \u4e0e <code>WHERE<\/code> \u5b50\u53e5\u8fdb\u884c\u6761\u4ef6\u8fc7\u6ee4\uff0c\u4f8b\u5982\u67e5\u627e\u540d\u5b57\u4e3a <code>\"alice\"<\/code> \u7684\u5458\u5de5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT emp_id, emp_name\nFROM employees\nWHERE UCASE(emp_name) = 'ALICE';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u67e5\u8be2\u7ed3\u679c<\/strong>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>emp_id<\/th><th>emp_name<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Alice<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8fd9\u4e2a\u67e5\u8be2\u4e2d\uff0c<code>UCASE()<\/code> \u51fd\u6570\u5c06 <code>emp_name<\/code> \u5217\u7684\u6240\u6709\u503c\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\uff0c\u4ece\u800c\u786e\u4fdd\u67e5\u8be2\u5ffd\u7565\u5927\u5c0f\u5199\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>UCASE()<\/code> \u5728\u4e0d\u540c\u7684\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u53ef\u80fd\u6709\u4e0d\u540c\u7684\u5b9e\u73b0\u65b9\u5f0f\u3002\u5728\u67d0\u4e9b\u7cfb\u7edf\u4e2d\uff0c<code>UCASE()<\/code> \u53ef\u4ee5\u4e0e <code>UPPER()<\/code> \u4e92\u6362\u4f7f\u7528\u3002<\/li>\n\n\n\n<li><code>UCASE()<\/code> \u53ea\u5f71\u54cd\u5b57\u6bcd\u5b57\u7b26\uff0c\u5bf9\u4e8e\u975e\u5b57\u6bcd\u5b57\u7b26\uff08\u5982\u6570\u5b57\u3001\u6807\u70b9\u7b26\u53f7\u7b49\uff09\uff0c\u5b83\u4eec\u4e0d\u4f1a\u53d1\u751f\u53d8\u5316\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong><code>UCASE()<\/code> \u4e0e <code>LOWER()<\/code> \u5bf9\u6bd4<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>UCASE()<\/code><\/strong>\uff1a\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\u3002<\/li>\n\n\n\n<li><strong><code>LOWER()<\/code><\/strong>\uff1a\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5c0f\u5199\u5b57\u6bcd\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff0c\u5c06 <code>emp_name<\/code> \u5217\u8f6c\u6362\u4e3a\u5c0f\u5199\u5b57\u6bcd\u7684 SQL \u67e5\u8be2\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT emp_id, LOWER(emp_name) AS emp_name_lowercase\nFROM employees;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u67e5\u8be2\u7ed3\u679c<\/strong>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>emp_id<\/th><th>emp_name_lowercase<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>alice<\/td><\/tr><tr><td>2<\/td><td>bob<\/td><\/tr><tr><td>3<\/td><td>charlie<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>UCASE()<\/code> \u662f\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u6bcd\u8f6c\u6362\u4e3a\u5927\u5199\u7684 SQL \u51fd\u6570\u3002<\/li>\n\n\n\n<li>\u5b83\u53ef\u4ee5\u4e0e\u5176\u4ed6 SQL \u67e5\u8be2\u529f\u80fd\uff08\u5982 <code>WHERE<\/code>\uff09\u4e00\u8d77\u4f7f\u7528\uff0c\u4ee5\u4fbf\u5904\u7406\u5927\u5c0f\u5199\u4e0d\u654f\u611f\u7684\u6761\u4ef6\u3002<\/li>\n\n\n\n<li>\u5728\u8bb8\u591a\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\uff0c<code>UCASE()<\/code> \u548c <code>UPPER()<\/code> \u662f\u7b49\u6548\u7684\uff0c\u53ef\u4ee5\u4e92\u6362\u4f7f\u7528\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>UCASE() \u662f SQL \u4e2d\u7684\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709\u5b57\u6bcd\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\u3002\u5b83\u662f SQL \u4e2d\u5904\u7406\u5927\u5c0f\u5199\u8f6c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-1735","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1735"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1735\/revisions"}],"predecessor-version":[{"id":1736,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1735\/revisions\/1736"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}