时间:2021-07-01 10:21:17 帮助过:77人阅读
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
最常用到的方式如下 (在这里我们用SUBSTR()为例):
SUBSTR(str,pos): 由
SUBSTR(str,pos,len): 由
SELECT
SUBSTR(COURSE_DESIGNATER,6,3) as "Course number"
FROM COURSES
WHERE COURSE_DESIGNATER LIKE 'Excel%'
实例二
SELECT
UPPER(SUBSTR(lastname,1,1)) || LOWER(SUBSTR(lastname,2,29))
AS "Lastname"
FROM Students