当前位置:网站首页>MySQL review materials (additional) case when
MySQL review materials (additional) case when
2022-06-29 03:51:00 【Red eye Aromatherapy】

MySQL Review the information ( additional )case when
The article links
MySQL Review the information ( One )——MySQL Environmental installation
MySQL Review the information ( Two )——MySQL-DDL sentence
MySQL Review the information ( 3、 ... and )——MySQL-DML sentence
MySQL Review the information ( Four )——MySQL- Aggregate functions
MySQL Review the information ( 5、 ... and )——MySQL- Indexes
MySQL Review the information ( 6、 ... and )——MySQL- Multi table joint query
MySQL Review the information ( 7、 ... and )——MySQL- stored procedure
MySQL Review the information ( 8、 ... and )——MySQL- Business
MySQL Review the information ( Nine )——MySQL- Graphical tools use
Content of this chapter :case when Use
/*
Navicat Premium Data Transfer
Source Server : rm-bp1zq3879r28p726lco.mysql.rds.aliyuncs.com_3306
Source Server Type : MySQL
Source Server Version : 50732
Source Host : rm-bp1zq3879r28p726lco.mysql.rds.aliyuncs.com:3306
Source Schema : mytest
Target Server Type : MySQL
Target Server Version : 50732
File Encoding : 65001
Date: 28/06/2022 18:58:48
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`createDate` datetime(0) NOT NULL,
`userName` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`passWord` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`age` int(3) NOT NULL,
`phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`introduce` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `userName_index`(`userName`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, '2022-06-26 13:43:11', 'admin', '123456', 22, '15912345678', ' Like learning .');
INSERT INTO `users` VALUES (2, '2022-06-26 13:43:11', 'zhangsan', '123456', 32, '15912345678', ' I love cooking .');
INSERT INTO `users` VALUES (3, '2022-06-26 13:43:11', 'lisi', '45451', 42, '15912345678', ' I like make-up .');
INSERT INTO `users` VALUES (4, '2022-06-26 13:43:11', 'zhaoliu', '2222', 52, '15912345678', ' Like martial arts .');
INSERT INTO `users` VALUES (5, '2022-06-26 13:43:11', 'zhaoliu', '11111', 16, '15912345678', ' Like dancing .');
INSERT INTO `users` VALUES (6, '2022-06-26 13:43:11', 'zhaoliu', '123787', 27, '15912345678', ' Like to pick up girls .');
SET FOREIGN_KEY_CHECKS = 1;
test :
Direct unsigned judgment
select userName,
(
case
when sex=0 then ' Woman '
when sex=1 then ' male '
end
) sexName
from users;
Signed judgment
select userName,age,
(
case
when age<20 then ' teenagers '
when age<30 then ' youth '
else ' Prime of life '
end
) state
from usersCreate view , And query against the view
# Query and create views
create view newTableName as (
select userName,age,
(
case
when age<20 then ' teenagers '
when age<30 then ' youth '
else ' Prime of life '
end
) state
from users
);
select state ' state ',count(state) ' Number '
from newTableName GROUP BY state;Pay attention to practice .
边栏推荐
- 4种分布式session解决方案
- [tcapulusdb knowledge base] Introduction to tcapulusdb data import
- Common methods of JS date and time
- 88.(cesium篇)cesium聚合图
- [tcaplusdb knowledge base] Introduction to tcaplusdb tcapulogmgr tool (II)
- Data statistical analysis (SPSS) [5]
- Implementing mqtt communication with PHP
- An internal error occurred during: 'Retrieving archetypes:'.
- [tcapulusdb knowledge base] Introduction to tcapulusdb table data caching
- 情绪的变化需要控制
猜你喜欢

Solid state and memory module purchase

【TcaplusDB知识库】修改业务修改集群cluster

Preliminary construction of SSM project environment

Kingbase export table structure

【TcaplusDB知识库】TcaplusDB-tcapulogmgr工具介绍(二)
![[tcapulusdb knowledge base] Introduction to tcapulusdb tcapsvrmgr tool (I)](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] Introduction to tcapulusdb tcapsvrmgr tool (I)

leetcode:560. 和为 K 的子数组

20款IDEA 神级插件 效率提升 30 倍,写代码必备

2D人体姿态估计 - DeepPose

88.(cesium篇)cesium聚合图
随机推荐
Adelaidet (detectron2) & abcnet environment configuration
An internal error occurred during: 'Retrieving archetypes:'.
【TcaplusDB知识库】TcaplusDB-tcaplusadmin工具介绍
为什么信息化 ≠ 数字化?终于有人讲明白了
[tcaplusdb knowledge base] Introduction to tcaplusdb tcaplusadmin tool
Data statistical analysis (SPSS) [3]
Inventory deduction based on redis
2D human posture estimation deeppose
87.(cesium篇)cesium热力图(贴地形)
Yangzhou needs one English IT Helpdesk Engineer -20220216
2022年 6月27号 《暑假感悟篇一》路程的选择权。
Access 500 error after modstart migrates the environment
【TcaplusDB知识库】修改业务修改集群cluster
【若依(ruoyi)】ztree初始化
[Ubuntu] [MySQL] Ubuntu installs mysql, but the compilation error is mysql h: No such file or directory
mysql varcahr 转 int
【Ubuntu】【Mysql】ubuntu安装了mysql 但是编译报错 mysql.h: No such file or directory
Web APIs high order functions - dark horse programmers
【世界海洋日】TcaplusDB号召你一同保护海洋生物多样性
VG4131SxxxN0S1无线模块硬件规格书