当前位置:网站首页>MySQL digital function
MySQL digital function
2022-07-06 17:00:00 【My71】
The database used in the following , May refer to Create exercise database
Find the absolute value
function :ABS(number)
Instructions
SELECT ABS(10) AS Take the absolute value , ABS(-10) AS Take the absolute value ;
Running results
averaging
function :AVG( Field )
demand : Calculation xs_kc The middle school number is 081101 Students' average grades in all courses .
Instructions
select Student number , Course no. ,avg( achievement ) as Average score from xs_kc where Student number ="081101"
Running results
Sum up
function :SUM()
demand : Calculation xs_kc The grades of all students in the table and .
Instructions
select sum( achievement ) as Total score from xs_kc
Running results
Exponentiation
function :POW(x,y)
explain : return x Of y Power
Instructions
SELECT POW(2,3),POW(3,2);
Running results
Seeking remainder
function :MOD(x,y)
explain : The return value is x Divide y The remainder of .
Instructions
SELECT MOD(10,3),MOD(10,5);
Running results
to be divisible by
grammar :x DIV y
explain : return x Divide y The integer part of the result , No rounding .
Instructions
SELECT 10 DIV 3,5 DIV 2;
Running results
Rounding up
function :CEIL()
explain : This function will return a minimum integer greater than or equal to this number .
Instructions
select CEIL(1.5);
Running results
Rounding down
function :FLOOR()
explain : This function will return a minimum integer less than or equal to this number .
Instructions
select FLOOR(1.5);
Running results
Round to the nearest whole
function :ROUND()
Instructions
SELECT ROUND(1.23),ROUND(1.57);
Running results
After decimal point n position
function :TRUNCATE(x,y)
explain :x Is the decimal to be processed ,y It's the number of reserved digits , No rounding occurs .
Instructions
SELECT TRUNCATE(3.1415926,2),TRUNCATE(3.1415926,4);
Running results
Return the maximum value in the field
function :MAX()
demand : find xs_kc The record with the highest score in the table .
demand
select Student number , Course no. ,max( achievement ) as Maximum score from xs_kc;
Running results
Return the minimum value in the field
function :MIN()
demand : find xs_kc The record with the lowest score in the table .
Instructions
select Student number , Course no. ,min( achievement ) as Maximum score from xs_kc;
Running results
Angle in radians
function :RADIANS()
Instructions
SELECT RADIANS(60),RADIANS(90);
Running results
The angle of arc
function :DEGREES()
Instructions
SELECT DEGREES(1.0471975511965976),DEGREES(1.5707963267948966);
Running results
边栏推荐
- Solr word segmentation analysis
- Log4j2 major vulnerabilities and Solutions
- Yao BanZhi and his team came together, and the competition experts gathered together. What fairy programming competition is this?
- Mongodb在node中的使用
- 8086 内存
- 汇编语言基础知识
- Restful style interface design
- 汇编课后作业
- Ruoyi-Cloud 踩坑的BUG
- ~75 background
猜你喜欢
~76 sprite map
逻辑运算指令
LeetCode 1552. Magnetic force between two balls
The QT program compiled on CentOS lacks a MySQL driven solution
字节跳动技术新人培训全记录:校招萌新成长指南
Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.
Eureka single machine construction
Description of project structure configuration of idea
Activiti目录(四)查询代办/已办、审核
~79 Movie card exercise
随机推荐
8086 内存
Log4j2 major vulnerabilities and Solutions
服务器端渲染(SSR)和客户端渲染(CSR)的区别
8086 CPU 内部结构
DS18B20數字溫度計系統設計
Ruoyi-Cloud 踩坑的BUG
Shell_ 04_ Shell script
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
Activiti目录(五)驳回、重新发起、取消流程
登陆验证koa-passport中间件的简单使用
Shell_ 06_ Judgment and circulation
Shell_ 00_ First meeting shell
搭建flutter环境入坑集合
LeetCode 1562. Find the latest group of size M
字节跳动开源GAN模型压缩框架,算力最高节省97.8%丨ICCV 2021
7-6 sum of combinatorial numbers
~72 horizontal and vertical alignment of text
唯有学C不负众望 TOP1环境配置
逻辑运算指令
Error occurred during initialization of VM Could not reserve enough space for object heap