查找在MySQL中排第二位的特定记录
为此,请使用SUBSTR()以下语法-
select * from yourTableName where substr(yourColumnName, 2, 1 ) = ' ';
让我们首先创建一个表-
mysql> create table DemoTable1365
-> (
-> Value varchar(20)
-> );使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1365 values('9756757474');
mysql> insert into DemoTable1365 values('3 45322333');
mysql> insert into DemoTable1365 values('8974646363');
mysql> insert into DemoTable1365 values('9 566363622');使用select语句显示表中的所有记录-
mysql> select * from DemoTable1365;
这将产生以下输出-
+-------------+ | Value | +-------------+ | 9756757474 | | 3 45322333 | | 8974646363 | | 9 566363622 | +-------------+ 4 rows in set (0.00 sec)
这是查询以查找表中的特定记录,该记录仅在第二位具有空格,例如“34532”-
mysql> select * from DemoTable1365
-> where substr(Value, 2, 1 ) = ' ';这将产生以下输出-
+-------------+ | Value | +-------------+ | 3 45322333 | | 9 566363622 | +-------------+ 2 rows in set (0.00 sec)
热门推荐
10 孩子语音婚礼祝福语简短
11 对情侣朋友祝福语简短
12 新年顾客简短祝福语大全
13 国庆节日简短祝福语
14 社团迎新祝福语简短英语
15 简短的祝福语中秋搞笑
16 对新人祝福语大全简短
17 升学宴同学祝福语简短
18 上级生日祝福语 简短独特