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
Background: Make a little progress every day, acc...
Virtualization and containerization are two inevi...
Table of contents A. Docker deployment of springb...
This article uses examples to describe the common...
Table of contents 1. Introduction 2. Installation...
Table of contents 1. Overview 1.1 What is a proto...
The role of the a tag pseudo-class: ":link&qu...
Nowadays, many websites do not allow direct copyin...
I downloaded and installed the latest version of ...
Some MySQL tables may contain duplicate records. ...
The backend uses the thinkphp3.2.3 framework. If ...
Install Docker Desktop Download address: Docker D...
There are already many articles about slot-scope ...
I often need to change nginx configuration at wor...
Description of the situation: Today, I logged int...