查找在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 送给学长毕业祝福语简短