MySQL创建表 的理解

create table t1(id int,name varchar(20)) engine=innodb default charser=utf8;

innodb  支持事务(eg:取钱事务)
myisam myisam 不支持事物 

auto_increment 表示:自增
primary key :表示 约束(不能重复,不能为空);加速查找

数据类型:
	数字:
		tinyint
		int
		bigint

		float 不准确
		double  不准确  五十步笑百步
		decimal  精准 是以字符串存取,但取得时候还是数字类型
			
	字符串:
		char(10) :未沾满填充字符,  查找速度快 , 长度最高255
		varchar(10):实际数据长度 ,节省空间 ,查找速度没有char快,  长度最高255
		test
		对于上传文件 :存路径
	时间:
		date :年月日
		datetime:年月日时分秒
	枚举 enum
	![例子](https://img-blog.csdnimg.cn/20190408205113246.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5MDYyODg4,size_16,color_FFFFFF,t_70)
	集合 set

猜你喜欢

转载自blog.csdn.net/qq_39062888/article/details/89107558