MySQL--增删查改

创建 表

​
create table hubotao3(
id INT(10) not null,
name1 VARCHAR(10) DEFAULT null,
date1 DATE DEFAULT NULL,      --我用小写default ,报错
PRIMARY KEY(id)     --加逗号 , 报错
)ENGINE=INNODB;   

​

修改表名

alter table hubotao3 rename hubotao;

删表

drop table hubotao6

增加 列

​
alter table hubotao3 add column column4  INT(11) not null;

​

修改列

alter table hubotao3 change column column5 columnChange VARCHAR(10);

删除列

alter table hubotao3 drop column columnChange;

查询记录

select * from hubotao3

 增加记录

insert into hubotao3 values(1,'hubotao','20180802',11);

更新记录

update hubotao3 set name1='hhh' where id=1;

删除记录

DELETE from hubotao3 where id=1;

猜你喜欢

转载自blog.csdn.net/hu_bo_tao/article/details/81368500