(一)MySQL version

MySQL Server 8.0.29

MySQL Workbench 8.0.29

(二)语句及问题

1. 语句:

#5月17日学习#创建大气质量表
use test;
create table Monthly_Indicator(city_name varchar(20) NOT NULL,month_key date NOT NULL,aqi int(4) DEFAULT 0,aqi_range varchar(20) NOT NULL,air_quality varchar(20) NOT NULL,pm25 float(6,2) DEFAULT 0,pm10 float(6,2) DEFAULT 0,so2 float(6,2) DEFAULT 0,co float(6,2) DEFAULT 0,no2 float(6,2) DEFAULT 0,o3 float(6,2) DEFAULT 0,ranking int(4) DEFAULT 0,PRIMARY KEY(city_name,month_key));

2. 问题:

警告1:1681 Integer display width is deprecated and will be removed in a future release.

警告2:1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release.

(三)原因

警告1:1681 Integer display width is deprecated and will be removed in a future release.

( 翻译:Integer display width已弃用,将在未来版本中删除。)

  • int(M):在指定字段为整型时,限制该字段显示的数据宽度为M,即display width;
  • 例子:phone_number int(11),意味着phone_number在查询时会显示11位数字。如果实际phone_number数字比11个少,会自动填充0补足11位;如果实际phone_number数字比11个多,则会显示其实际的数字个数;
  • 注意区分:int(M)中的M只是人为指定的显示宽度,并不是int类型存储的范围。即:无论指定多大的显示宽度,int都占4字节长度(32位);

MySQL从8.0.17开始就不建议对int指定显示宽度,也将在未来的版本中删除这一个规则。因此,我们只需要把int(M)中的M删掉就好;

警告2: 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release.

(翻译:不推荐为浮点数据类型指定位数,并将在将来的版本中删除。)

  • float(m,d):指定字段为浮点型时,限制该字段数字总个数为m,其中小数位数为d;
  • 例子:float(4,2)的范围是-99.99到99.99。当录入数字不符合指定条件时,会对数字进行四舍五入后保存,如在float(4,2)列内录入9.009,近似后保存的结果为9.01。
  • 浮点数据类型的缺陷:由于float和double都存在四舍五入的情况,因此容易使数据产生误差。如果希望保存高精度的数据,请使用decimal数据类型;

由于注意到浮点数据类型的缺陷,MySQL团队自8.0.17开始宣布将取消掉对浮点数据类型指定位数的操作。因此,我们只需要把float(m,d)改成float就好;

(四)解决方案

#5月17日学习#创建大气质量表
use test;
create table Monthly_Indicator(city_name varchar(20) NOT NULL,month_key date NOT NULL,aqi int DEFAULT 0,aqi_range varchar(20) NOT NULL,air_quality varchar(20) NOT NULL,pm25 float DEFAULT 0,pm10 float DEFAULT 0,so2 float DEFAULT 0,co float DEFAULT 0,no2 float DEFAULT 0,o3 float DEFAULT 0,ranking int DEFAULT 0,PRIMARY KEY(city_name,month_key));

【MySQL】警告: 1681 - XXX is deprecated and will be removed in a future release.相关推荐

  1. currentlyFocusedField is deprecated and will be removed in a future release解决方法记录

    参考https://github.com/aksonov/react-native-router-flux/issues/3691 This issue is related to transitiv ...

  2. php解决 mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysq

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. The mysql extension is deprecated and will be removed i ...

  3. 【解决两个警告】Model.fit_generator` is deprecated and will be removed in a future version. Please use `Mode

    在训练 经典卷积神经网络VGG时,因为版本问题,报了警告,下面来解决警告. 其实警告,大多来自前后版本的问题,可能你使用的这个版本里面对于一个方法是这个要求,下一个版本或者更新的版本,对于这个方法就是 ...

  4. PHP 5.6 中 Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future

    在使用数组转换为XML 时,出现这种错误 Automatically populating $HTTPRAWPOSTDATA is deprecated and will be removed in ...

  5. DeprecationWarning:current URL string parser is deprecated, and will be removed in a future version.

    DeprecationWarning:current URL string parser is deprecated, and will be removed in a future version. ...

  6. WARNING: --master-data is deprecated and will be removed in a future version

    Mysql 版本:/usr/local/mysql/bin/mysql Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL) 报错 ...

  7. neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead

    1.现象描述: 以前在测试环境中使用过icehouse版本,记得当时查看网络列表是使用neutron net-list,最近两天在测试openstack ocata的时候发现好多之前的命令都不能正常使 ...

  8. Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version.

    2019独角兽企业重金招聘Python工程师标准>>> PHP 接口,使用 ajax post方式提交数据的时候报错: Automatically populating $HTTP_ ...

  9. 警告Warning: Nashorn engine is planned to be removed from a future JDK release

    在java11中使用Nashorn engine,会有警告Warning: Nashorn engine is planned to be removed from a future JDK rele ...

最新文章

  1. python读取浮点数与源文件不同
  2. 以太坊白皮书_区块链60讲第33集~什么是以太坊?
  3. Chapter 6 : 综合数据和分组函数
  4. python matplotlib 画图神器
  5. php文件写入生成文件,PHP 文件操作类(创建文件并写入) 生成日志
  6. Nginx的error_page指令
  7. SAP UI5 初学者教程之十一 :SAP UI5 容器类控件 Page 和 Panel 试读版
  8. (原创)自已实现服务器控件 之 简单的Label控件
  9. Https的前世今生
  10. Silverlight 2动态创建矩形对象(附完整源代码)
  11. 爬虫入门之绘图matplotlib与词云(七)
  12. MySQL-第八篇MySQL内置函数
  13. UI设计素材干货,字体设计灵感酷站
  14. 编程c语言中文图形代码,C语言图形编程代码
  15. 工程计算——实战:追赶法扰动分析
  16. Windows10新版本设置卓越性能
  17. cass坡度土方计算案例_四面放坡且坡度不同的工程土方,CASS怎么算?
  18. 第六章-网络可靠性设计
  19. 成都Uber优步司机奖励政策(2月29日)
  20. 使用itext和freemarker来根据Html模板生成PDF文件,加水印、印章

热门文章

  1. NoneType‘ object has no attribute ‘loader‘
  2. android VideoView的使用例程
  3. wow服务器维护8月14,8月14日服务器例行维护公告(已完成)
  4. 能独步天下吗?揭开至强E5处理器的最后面纱
  5. 千斤顶装配图怎么画_工程制图习题集千斤顶装配图
  6. 解决:找不到step7 basic。
  7. FastJson快速上手【Json解析工具】
  8. 深入解析:如何修复SSL / TLS握手失败错误(上)
  9. 台式计算机系统错误,台式电脑开机蓝屏,代码是0×0000006B,怎么修复?
  10. 连接到手机热点显示无法解析服务器,Win10系统电脑可以成功连接上手机的热点但连不上网该如何处理...