用于SUBSTRING()在定界符后返回值。让我们首先创建一个表-mysql>createtableDemoTable
->(
->Titletext
->);
使用插入命令在表中插入一些记录-mysql>insertintoDemoTablevalues('JohnisgoodinMySQL,SamisgoodinMongoDB,MikeisgoodinJava');
使用select语句显示表中的所有记录-mysql>select*fromDemoTable;
输出结果
这将产生以下输出-+-------------------------------------------------------------------+
|Title|
+-------------------------------------------------------------------+
|JohnisgoodinMySQL,SamisgoodinMongoDB,MikeisgoodinJava|
+-------------------------------------------------------------------+
1rowinset(0.00sec)
这是在定界符后返回子字符串的查询。mysql>selectsubstring(Title,instr(Title,',')+1)asAfterDelimiterfromDemoTable;
输出结果
这将产生以下输出-+---------------------------------------------+
|AfterDelimiter|
+---------------------------------------------+
|SamisgoodinMongoDB,MikeisgoodinJava|
+---------------------------------------------+
1rowinset(0.03sec)