当前位置:网站首页>How MySQL sums columns
How MySQL sums columns
2022-06-21 20:06:00 【Yisu cloud】
mysql How to sum Columns
This article introduces “mysql How to sum Columns ” Knowledge about , During the operation of the actual case , Many people will encounter such difficulties , Next, let Xiaobian lead you to learn how to deal with these situations ! I hope you will read carefully , Be able to learn !
stay mysql in , have access to SUM() Function to sum the columns ;SUM() Is a function of summation , You can return the sum of the specified column values , grammar “SELECT SUM(DISTINCT Name ) FROM Table name ;”,“DISTINCT” Operator allows you to evaluate different values in a collection ;SUM() When the function is evaluated , Column values of NULL The line of .
The operating environment of this tutorial :windows7 System 、mysql8 edition 、Dell G3 The computer .
stay mysql in , have access to SUM() Function to sum the columns .
SUM() Is a function of summation , Returns the sum of the values of the specified column . grammar :
SELECT SUM(DISTINCT Name ) FROM Table name ;
DISTINCT Operator allows you to evaluate different values in a collection
explain :
If no matching line is returned in the SELECT Use in statement SUM function , be SUM The function returns NULL, instead of 0.
SUM() When the function is evaluated , Column values of NULL The line of
mysql SUM() Column summation example
Create a student transcript tb_students_score
CREATE TABLE tb_students_score(id INT(11),student_name VARCHAR(25),student_score INT(11));

After inserting data , View the data

Use sum() Function in tb_students_score Calculate the total score of students' grades in the table
SELECT SUM(student_score) FROM tb_students_score;

“mysql How to sum Columns ” That's all for , Thanks for reading . If you want to know more about the industry, you can pay attention to Yisu cloud website , Xiaobian will output more high-quality practical articles for you !
边栏推荐
- nacos-配置中心-源码
- 日常开发常用工具提升效率
- 谷歌浏览器80版本以后,如何处理出现的问题SameSite跨域问题
- mysql如何实现分组求和
- Uniapp applet opens the map and selects the location demo effect wx Chooselocation
- 机器学习之贝叶斯分类与集成学习
- Post to asp Net core length limitation and solution when transferring data
- 机器学习之神经网络与支持向量机
- Startup mode of Jupiter notebook and related problems
- 基于k近邻的MNIST图像分类对比
猜你喜欢

【微信小程序更改appid失败】微信小程序修改appid一直失败报错tourist appid解决办法

转发提醒 MetaMask小狐狸钱包安全公告 如何应对拓展程序潜在的私钥泄露

机器学习之神经网络与支持向量机

范畴(Category)

How to set the picture background to transparent

HMS core machine learning service ID card identification function to achieve efficient information entry

Tableapi & SQL and example module of Flink

zabbix6.0+timescaledb+企业微信告警

MySQL-CentOS安装MySQL8

自定义代码模板
随机推荐
SQL operation: with expression and its application
NetCore3.1 ping网络是否畅通及获取服务器Cpu、内存使用率
MFC界面库BCGControlBar v33.0 - 桌面警报窗口、网格控件升级
1156 Sexy Primes
Cloudcompare & PCL point cloud AABB bounding box
API interface for discharge summary identification - medical bill OCR identification / discharge diagnosis record / electronic medical record / claim settlement service
508. Most Frequent Subtree Sum
Manjaro installs the downloaded TTF font file
API de table & SQL et module d'échantillon pour le système Flink
RecycleView懒加载失效问题(二)
Cloudcompare & PCL point cloud point matching (based on European distance)
【干货知识】Redis:从应用到底层,一文帮你搞定
Gradle download and installation configuration
动态规划【一】(背包问题)
婴儿名字[连通分量之邻接矩阵与DFS]
[high frequency interview questions] the difficulty is 1.5/5. Common two point double pointer interview questions
Nacos configuration center source code
W10 add system environment variable path
Novice uses apiccloud visual development to build the mall home page
Jupyter Notebook启动方式及相关问题