SQL LCASE() 函數(shù)
LCASE() 函數(shù)把字段的值轉(zhuǎn)換為小寫。
SQL LCASE() 語法
SELECT LCASE(column_name) FROM table_name;
用于 SQL Server 的語法
SELECT LOWER(column_name) FROM table_name;
演示數(shù)據(jù)庫
在本教程中,我們將使用眾所周知的 Northwind 樣本數(shù)據(jù)庫。
下面是選自 "Customers" 表的數(shù)據(jù):
CustomerID | CustomerName | ContactName | Address | City | PostalCode | Country |
---|---|---|---|---|---|---|
1
|
Alfreds Futterkiste | Maria Anders | Obere Str. 57 | Berlin | 12209 | Germany |
2 | Ana Trujillo Emparedados y helados | Ana Trujillo | Avda. de la Constitución 2222 | México D.F. | 05021 | Mexico |
3 | Antonio Moreno Taquería | Antonio Moreno | Mataderos 2312 | México D.F. | 05023 | Mexico |
4
|
Around the Horn | Thomas Hardy | 120 Hanover Sq. | London | WA1 1DP | UK |
5 | Berglunds snabbk?p | Christina Berglund | Berguvsv?gen 8 | Lule? | S-958 22 | Sweden |
SQL LCASE() 實(shí)例
下面的 SQL 語句從 "Customers" 表中選取 "CustomerName" 和 "City" 列,并把 "CustomerName" 列的值轉(zhuǎn)換為小寫:
實(shí)例
SELECT LCASE(CustomerName) AS Customer, City
FROM Customers;
FROM Customers;
更多建議: