查找在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 生日广州男生祝福语简短