当前位置:网站首页>MySQL sort
MySQL sort
2022-07-25 14:48:00 【Delicious radish】
1, Basic DESC、ASC Sort
select * from tableName order by columnName1 desc,columnName2 asc;
2, Chinese sorting .MySQL Queries are case insensitive , Commonly used ISO-8859 As the default character set . Therefore, there is no way to correctly compare Chinese encoded characters . There are two ways to solve :
1. Under table , Add "binary" attribute . example :name varchar(5) binary.
2. Force on query MySQL Use the specified characters to query , keyword "convert()". example :
select * from tableName order by convert(columnName using gbk);
3, Sort by value
Match the field value with "value1","value2","value3" Compare , And output in the corresponding order , If you encounter str by null Or if it doesn't exist , Then the sequence is 0.
example :select * from tableName order by field(columnName,"value1","value2","value3");
边栏推荐
- I2C设备驱动程序的层次结构
- (original) customize a scrolling recyclerview
- Awk from getting started to digging in (20) awk parsing command line parameters
- 27 classification of selectors
- Several methods of spark parameter configuration
- Educational Codeforces Round 132 (Rated for Div. 2) C,D+AC自动机
- Paddlenlp's UIE relationship extraction model [executive relationship extraction as an example]
- 牛客多校 E G J L
- Gonzalez Digital Image Processing Chapter 1 Introduction
- Practical guide for network security emergency response technology (Qianxin)
猜你喜欢

【口才】谈判说服技巧及策略

06. Neural network like

直播课堂系统05-后台管理系统

Resource not found: rgbd_ Launch solution

Under the epidemic, the biomedical industry may usher in breakthrough development

阿里云安装MYSQL5.7

27 classification of selectors

牛客多校 E G J L

变分(Calculus of variations)的概念及运算规则
![Number of high-quality number pairs [bit operation characteristics + abstract ability evaluation + grouping fast statistics]](/img/c9/8f8f0934111f7ae8f8abd656d92f12.png)
Number of high-quality number pairs [bit operation characteristics + abstract ability evaluation + grouping fast statistics]
随机推荐
thymeleaf设置disabled
How to use the random number function of JMeter
Kibana operation es
37 element mode (inline element, block element, inline block element)
51单片机学习笔记(2)
PHP 通过原生CURL实现非阻塞(并发)请求模式
OverTheWire-Natas
基于PaddleOCR开发uni-app离线身份证识别插件
转载----如何阅读代码?
D2. Chopping Carrots (Hard Version) (每日一题)
Syntax summary of easygui
[cartographer_ros] VIII: Official demo parameter configuration and effect
Thymeleaf controls whether display is displayed through style
37 元素模式(行内元素,块元素,行内块元素)
【MySQL系列】-索引知多少
gson与fastjson
The input input box of H5 page pops up the numeric keypad, which needs to support decimal points
(original) customize a scrolling recyclerview
How to make a set of code fit all kinds of screens perfectly?
44 新浪导航 ,小米边栏 练习