建表、desc显示表、添加add、删除drop、修改modify、改列名change、drop table a 删表名

CREATE TABLE employee(
id TINYINT PRIMARY KEY auto_increment,主键,自增1,2,3,4,5.。。
      name VARCHAR(25),
gender boolean,
age INT ,
department VARCHAR (20),
salary DOUBLE (7,2)

--float(4,2):4位数其中2位是小数如72.23
--char(3)就是只能3个,定长的必须满足
--varchar(20)最多20是一个范围型数据,用的多,一个汉字3个字节
--blob 存的是二进制形式的长文本数据 0-65535字节
--mediumblob 中长 0-16777215
--LONGBLOB 存的是 极大的二进制形式数据
--text 村的是文本数据
)

详细信息 desc employee

添加  alter table employee add is_married tinyint(1);

 alter table employee add entry_date DATE not null;

 删除:alter table employee drop a;

修改:modify:alter table employee modify id int;

 修改列名为depart  用change 同时放在salary字段后面: alter table employee change department depart varchar(20) after salary;

表名重命名:rename table employee to s3;

drop table a;


原文地址:https://www.cnblogs.com/wfl9310/p/9299518.html