SQL LCASE() 函数
LCASE() 函数
LCASE() 函数把字段的值转换为小写。
SQL LCASE() 语法
SELECT LCASE(column_name) FROM table_name;
用于 SQL Server 的语法
SELECT LOWER(column_name) FROM table_name;
演示数据库
在本教程中,我们将使用 yssmx 样本数据库。
下面是选自 "Websites" 表的数据:
+----+--------------+---------------------------+-------+---------+ | id_name _url _alexa_country | +----+--------------+---------------------------+-------+---------+ | 1 _Google _https://www.google.cm/ _1 _USA | | 2 _淘宝 _https://www.taobao.com/ _13 _CN | | 3 _云搜索MX教程 _/ _4689 _CN | | 4 _微博 _http://weibo.com/ _20 _CN | | 5 _Facebook _https://www.facebook.com/_3 _USA | | 7 _stackoverflow_http://stackoverflow.com/_ 0_IND | +----+---------------+---------------------------+-------+---------+
SQL LCASE() 实例
下面的 SQL 语句从 "Websites" 表中选取 "name" 和 "url" 列,并把 "name" 列的值转换为小写:
实例
SELECT LCASE(name) AS site_title, url
FROM Websites;
FROM Websites;
执行以上 SQL 输出结果如下: