mysql⼤⼩写排序_MySQL按⼤⼩写排序?
为此,请使⽤order by nullif()。让我们⾸先创建⼀个表-mysql> create table DemoTable672(
CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
CustomerName varchar(100),
extend是什么意思英语CustomerAmount int
);
使⽤插⼊命令在表中插⼊⼀些记录-mysql> insert into DemoTable672(CustomerName,CustomerAmount) values('Chris',560); mysql> insert into DemoTable672(CustomerName,CustomerAmount) values('Robert',null);
mysql> insert into DemoTable672(CustomerName,CustomerAmount) values('',450);
视频教学在线观看mysql> insert into DemoTable672(CustomerName,CustomerAmount) values('David',456);
mysql> insert into DemoTable672(CustomerName,CustomerAmount) values('Carol',786);
使⽤select语句显⽰表中的所有记录-mysql> select *from DemoTable672;
这将产⽣以下输出-+------------+--------------+----------------+
| CustomerId | CustomerName | CustomerAmount |
内网创建springboot项目+------------+--------------+----------------+
| 1 | Chris | 560 |mysql语句顺序
| 2 | Robert | NULL |
| 3 | | 450 |
| 4 | David | 456 |
| 5 | Carol | 786 |
+------------+--------------+----------------+
5 rows in set (0.00 sec)
以下是如何通过⼤⼩写执⾏MySQL命令。在这⾥,我们还使⽤FIELD()了不区分⼤⼩写的搜索-
mysql> select *from DemoTable672 ORDER BY NULLIF(CustomerName,'') IS NULL, FIELD(CustomerAmount,560,786,450,456);
这将产⽣以下输出-+------------+--------------+----------------+
| CustomerId | CustomerName | CustomerAmount |
+------------+--------------+----------------+
| 2 | Robert | NULL |
| 1 | Chris | 560 |
| 5 | Carol | 786 |
威尔士对英格兰比分| 4 | David | 456 |
简单的视频播放器html| 3 | | 450 |
+------------+--------------+----------------+
5 rows in set (0.04 sec)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论