lcase和ucase
Upper Case, Lower Case and MID functions are scalar functions which return a single value, based in the input value.
大写,小写和MID函数是标量函数,它们基于输入值返回单个值。
As you all know sometimes different databases have not more but, have some minor changes in their syntax's. Similarly, for convert a field value to the upper case, lower case and for MID value different syntax are there for the different database:
众所周知,有时不同的数据库并没有更多的功能,但是它们的语法有一些细微的变化。 同样,对于将字段值转换为大写,小写和MID值,对于不同的数据库,存在不同的语法:
Table: Let, we have a table name STUDENT
表格:让我们有一个表格名称STUDENT
1)UCASE()函数 (1) UCASE() function)
This function is used to converts a field value to upper case.
此函数用于将字段值转换为大写。
SYNTAX:
句法:
SELECT UCASE(column_name) FROM table_name;
SELECT UPPER(column_name) FROM table_name;
Example:
例:
2)LCASE()函数 (2) LCASE() function)
This function is used to converts a field value to lower case.
此函数用于将字段值转换为小写。
SYNTAX:
句法:
SELECT LCASE(column_name) FROM table_name;
SELECT LOWER(column_name) FROM table_name;
Example:
例:
3)MID()函数 (3) MID() function)
This function is used to extract the char from a text field.
此函数用于从文本字段中提取字符。
SYNTAX:
句法:
SELECT MID(column_name,start,length) AS some_name FROM table_name;
column_name, start, length are the required parameters in MID() function. It is used to extract values of a field.
column_name , start , length是MID()函数中的必需参数。 它用于提取字段的值。
Where,
哪里,
column_name - is used to extract char.
column_name-用于提取字符。
start - shows the starting point like 0 or 1.
start-显示起点,例如0或1。
length - is to return the number of character.
length-是要返回的字符数。
AND,
和,
SUBSTRING() function is also used to extract MID() value. Basically, this SUBSTRING() function is used in SQL Server.
SUBSTRING()函数还用于提取MID()值。 基本上,此SUBSTRING()函数用于SQL Server。
SYNTAX:
句法:
SELECT SUBSTRING(column_name,start,length) AS name FROM table_name;
Conclusion:
结论:
In this article, we have learned how to use UCASE(), LCASE() and MID() functions in SQL and SQL queries? We will know more about different or use of another scalar function in SQL. Have a great day! Happy Learning!
在本文中,我们学习了如何在SQL和SQL查询中使用UCASE(),LCASE()和MID()函数 ? 我们将更多地了解SQL中其他标量函数的不同或使用。 祝你有美好的一天! 学习愉快!
翻译自: https://www.includehelp.com/sql/Use-of-UCASE-LCASE-and-MID-functions.aspx
lcase和ucase