First we create the database table: CREATE TABLE `t_demo` ( `id` int(32) NOT NULL, `name` varchar(255) DEFAULT NULL, `age` int(2) DEFAULT NULL, `num` int(3) DEFAULT NULL, PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; Insert data:
MySQL case when usage SELECT *, CASE WHEN t.num >= 85 THEN 'excellent' WHEN t.num < 90 AND t.num>= 60 THEN 'generally' ELSE 'Failure' END AS level FROM t_demo t; Query structure: The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Nginx improves access speed based on gzip compression
>>: Vue implements start time and end time range query
1. Why do packaging? Facilitates overall code cal...
<br />Looking at this title, you may find it...
CSS3 can change the color of pictures. From now o...
closure service nginx stop systemctl stop nginx s...
Disadvantages of Tables 1. Table takes up more byt...
1. Download jdk download address我下載的是jdk-8u221-li...
This method uses the drop-shadow filter in CSS3 t...
Preface: MYSQL should be the most popular WEB bac...
What is keepalive? In normal development, some co...
Preface We all know that in Linux, "everythi...
Table of contents Written in front Two-way encryp...
Table of contents HTTP hijacking, DNS hijacking a...
Here we introduce the knowledge about form elemen...
Introduction Incremental backup means that after ...
Uninstall MariaDB CentOS7 installs MariaDB instea...