在SQL语句中int代表你要创建字段的类型,int代表整型,11代表字段的长度。
这个代表显示宽度
整数列的显示宽度与需要用多少个字符来显示该列数值,与该整数需要的存储空间的大小都没有关系,比如,不管设定了显示宽度是多少个字符,bigint都要占用8个字节。
int是整型,(11)是指显示字符的长度,但要加参数的,最大为255,比如它是记录行数的id,插入10笔资料,它就显示00000000001 ~~~00000000010,当字符的位数超过11,它也只显示11位,如果你没有加那个让它未满11位就前面加0的参数,它不会在前面加0
声明整型数据列时,我们可以为它指定个显示宽度M(1~255),如INT(5),指定显示宽度为5个字符,如果没有给它指定显示宽度,MySQL会为它指定一个默认值。显示宽度只用于显示,并不能限制取值范围和占用空间,如:INT(3)会占用4个字节的存储空间,并且允许的最大值也不会是999,而是INT整型所允许的最大值。
MySQL有五种整型数据列类型,即TINYINT,SMALLINT,MEDIUMINT,INT和BIGINT。它们之间的区别是取值范围不同,存储空间也各不相同。
在整型数据列后加上UNSIGNED属性可以禁止负数,取值从0开始。
int范围
|
Bytes | Minimum Value | Maximum Value | ||||||||||||||||||||||||||||||||||||||||||||||||
(Signed/Unsigned) | (Signed/Unsigned) | ||||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">TINYINT</font> |
1 | <font face="NSimsun">-128</font> |
<font face="NSimsun">127</font> |
||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">0</font> |
<font face="NSimsun">255</font> |
||||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">SMALLINT</font> |
2 | <font face="NSimsun">-32768</font> |
<font face="NSimsun">32767</font> |
||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">0</font> |
<font face="NSimsun">65535</font> |
||||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">MEDIUMINT</font> |
3 | <font face="NSimsun">-8388608</font> |
<font face="NSimsun">8388607</font> |
||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">0</font> |
<font face="NSimsun">16777215</font> |
||||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">INT</font> |
4 | <font face="NSimsun">-2147483648</font> |
<font face="NSimsun">2147483647</font> |
||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">0</font> |
<font face="NSimsun">4294967295</font> |
||||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">BIGINT</font> |
8 | <font face="NSimsun">-9223372036854775808</font> |
<font face="NSimsun">9223372036854775807</font> |
||||||||||||||||||||||||||||||||||||||||||||||||
<font face="NSimsun">0</font> |
<font face="NSimsun">18446744073709551615</font> |
下面为官网的说明
代码如下 | 复制代码 |
Be careful when considering ENUM('T','F') as "true binary". Example: mysql> INSERT INTO `bits` (`val`) VALUES ('W'), ('T'), ('F'); mysql> SHOW WARNINGS; |
示例:
`val` ENUM('T','F') NOT NULL
);mysql>插入 `bits` (`val`) 值 ('W'), ('T'), ('F');
查询正常,3 行受影响,1 条警告(0.00 秒)
记录:3 重复:0 警告:1
mysql>显示警告;
--------- ------ -------------------------------------------------- -------- |级别 |代码|留言 | --------- ------ -------------------------------------------------- -------- |警告| 1265 | 1265第 1 行“val”列的数据被截断 | --------- ------ -------------------------------------------------- ------- 一组 1 行(0.00 秒) mysql>从位中选择计数(DISTINCT val); --------------------- |计数(不同的值)| -------------------- | 3 | --------------------- 一组 1 行(0.00 秒) 那么,二进制类型不应该只有两个不同的值吗? (请注意,它不为 NULL。) 手册说明(10.4.4. ENUM 类型): ----- 如果将无效值插入 ENUM(即允许值列表中不存在的字符串),则会插入空字符串作为特殊错误值。该字符串与“正常”空字符串的区别在于该字符串的数值为 0。稍后将详细介绍

mysqlviewshavelimitations:1)他们不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinSorsubqueries.2)他们canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementInmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)复杂的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通过PHP网页界面添加MySQL用户可以使用MySQLi扩展。步骤如下:1.连接MySQL数据库,使用MySQLi扩展。2.创建用户,使用CREATEUSER语句,并使用PASSWORD()函数加密密码。3.防止SQL注入,使用mysqli_real_escape_string()函数处理用户输入。4.为新用户分配权限,使用GRANT语句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingsefectery.1)usecharforfixed lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

禅工作室 13.0.1
功能强大的PHP集成开发环境

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。