当前位置:网站首页>SQL field type conversion
SQL field type conversion
2022-07-27 19:20:00 【The bearer of dark cuisine】
1、mysql vchar turn int、double etc.
MySQL Of CAST() Function can be used to get the value of a type , And produce another type of value
cast() Function is a conversion function , The argument is an expression , It includes the use of AS Key separated source and target data types .
cast Convert to double type , about D\M Value considerations .

# The formula
CAST(value as type);
#vchar turn int ( Decimals are rounded directly )
CAST(value as SIGNED);
#vchar turn double M Represents the reserved integer digits + Keep the decimal places ,D Represents the number of decimal places reserved
#1) Parameters m<65 It's the total number ,d<30 And d<m It's a decimal place .
#2)decimal The maximum possible value range is related to double equally , Its valid value range is, however M and D Value determination of .
# If you change M And fixed D, Then its value range will follow M That's bigger and bigger .
CAST(value as decimal(M,D));2、cast() Conversion type for function
Binary system , Syntaxis binary The effect of prefixes : BINARY
Character , With parameters : CHAR()
date : DATE
Time : TIME
Date time type : DATETIME
Floating point numbers : DECIMAL
Integers ( A signed ) : SIGNED
Unsigned integer ( Unsigned ): UNSIGNED 3、cast() and convert() Comparison
The same thing : It's all data type conversion , The functions realized are basically the same as
Difference : The grammar of the two is different ,cast(value as type) 、 convert(value,type)
If there are errors or inaccurate descriptions , Please correct me .
边栏推荐
- Double insurance for line breaking
- 200行代码快速入门文档型数据库MonogoDB
- Latex use - control the display position of tables or graphics
- Unity display Kinect depth data
- NPM basic use
- C语言案例:密码设置及登录> 明解getchar与scanf
- Rs2022/ cloud detection: semi supervised cloud detection in satellite images by considering the
- 图的遍历的定义以及深度优先搜索和广度优先搜索(二)
- Unity学习笔记——物体移动六种常见函数
- SQL server top 关键字使用
猜你喜欢

Win10 tips (1) -- transfer desktop location

During the interface test, connect to the database and back up, restore and verify the data source

Opening and using Alibaba cloud object storage OSS

There is a problem with the time zone when the idea connects to the database. The server returns invalid timezone is red Need to set ‘serverTimezone‘ property.

Kinect for Unity3d----KinectManager

Cyclic multi-Variate Function for Self-Supervised Image Denoising by Disentangling Noise from Image

ES6学习笔记(1)——快速入门

200 lines of code quick start document database monogodb

大冤种们,新进测试行业,如何正确选择意向企业?

Idea optimization strategy
随机推荐
v-if,v-else,v-for
Nodejs template engine EJS
Nacos基本概念和单机部署
Power control
Idea optimization strategy
Unity learning notes (rigid body physics collider trigger)
NPM, cnpm Taobao image
Micaz+tinyos learning notes (1)
Kinect2 for unity3d - avatardemo learning
又有一个Repeater的例子
Performance analysis of continuous time system (1) - performance index and first and second order analysis of control system
电磁场学习笔记-矢量分析和场论基础
The great idea of NS2
连续时间系统的性能分析(1)-控制系统性能指标及一二阶分析
WSN journal indexed by SCI
Analysis of Eureka server
idea优化小攻略
js常用utils封装
Latex use - control the display position of tables or graphics
Express get/post/delete... Request