当前位置:网站首页>MySQL creates a student table and queries grades
MySQL creates a student table and queries grades
2022-07-27 18:07:00 【Lush grass on the plains 77】
Create table
CREATE TABLE testdb.users (
`userid` INT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
`username` VARCHAR(20) NOT NULL,
`sex` CHAR (3) DEFAULT NULL,
`age` INT (3) DEFAULT NULL,
`num` BIGINT (200) DEFAULT NULL
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;Query table data
1, Query the total score of men and women
SELECT sex, sum(num) FROM testdb.users GROUP BY sex;2, Query the basic information of each user , Fraction in 90 For excellence ,[80,60) For good , Less than 60 For failing .
select
userid ,
username,
case
when num >90 then ' good '
when num <80
and num>60 then ' good '
else ' other '
end as ' achievement '
from
testdb.users u
边栏推荐
- Application of knowing things and learning | correlation graph analysis in anti cheating business
- [introduction to database system (Wang Shan)] Chapter 11 concurrency control
- Could not obtain transaction-synchronized Session for current thread
- 知物由学 | 易盾移动端同构实践,几步改善官网交互体验
- Behind every piece of information you collect, you can't live without TA
- 灵魂一问:为什么ES比MySQL更适合复杂条件搜索?
- What should we pay attention to when choosing the LED display screen of the stadium
- wallys/DR882-Qualcomm-Atheros-QCA9882-2T2R-MIMO-802.11ac-Mini-PCIe-Wi-Fi-Module-5G-high-power.
- 知物由学 | 从0到1搭建实时反外挂机制,多维度补充手游攻防力
- 如何开发一款在线Excel表格系统(上)
猜你喜欢

Taishan Office Technology Lecture: word strange paragraph borders

Fast analysis combined with Haidian medicine

Notes on standardized management of "ancestral warehouse" of meituan meal

【cf】#681 A. Kids Seating (Div. 2, based on VK Cup 2019-2020 - Final)

Know things by learning | build a real-time anti plug-in mechanism from 0 to 1 to supplement the offensive and defensive power of mobile games in multiple dimensions

公网域名如何解析到内网IP服务器——快解析域名映射外网访问

初识多态

知物由学 | 关联图分析在反作弊业务中的应用

Oracle 11g database installation tutorial

Configuration and basic use of vim
随机推荐
[user article] examples of P4 consolidation practice guide disassemble resolve
Are those who are absent from the written examination shortlisted for the teacher recruitment interview? Henan Xiangfu: the statistics of individual candidates' scores are wrong
年终总结模板
Learn from things | Yidun mobile terminal isomorphism practice, improve the official website interaction experience in a few steps
Numpy array matrix operation
golang worker池
Zhengzhou University database course resource description
用slmgr命令激活正版Win7旗舰版系统
The Ministry of industry and information technology re governs data security, and Netease Yidun "privacy compliance" keeps the bottom line of enterprise operation
Detailed explanation of browser caching mechanism
知物由学 | 易盾自研文本实时聚类技术,一网打尽社交网络中的同类有害内容
MLX90640 红外热成像仪测温传感器模块开发笔记(七)
Wechat applet realizes location map display and introduces map map without navigation
Mlx90640 infrared thermal imager temperature sensor module development notes (VII)
The whole process of neural network construction is finally completed! Can't you come to me~
[introduction to database system (Wang Shan)] Chapter 1 - Introduction
Mysql database defines cursor in trigger
Oracle 11g数据库安装教程
TCP connection status identification (syn, fin, ACK, PSH, RST, urg)
About the problem of abnormal C printing