create table classroom1(
cid int primary key auto_increment,
cname varchar (20),
`desc` varchar(20)
)
desc classroom
alter table classroom modify cid int auto_increment
insert into classroom values(3,'bd1903')
#给cname 字段添加值
insert into classroom(cname) values ('bd1904');
insert into classroom(cname,description) values ('bd1906','6描述');
#增加三条记录
insert into classroom(cname,description) values ('bd1907','7描述'),
('bd1908','8描述'),
('bd1909','9描述');
#将classroom数据转移到classroom1
insert into classroom1 select *from classroom
#创建表直接拿数据
create table user select *from userinfo ;
#创建表只拿结构
create table classroom2 select *from classroom where 0;
desc classroom2
#删除
#delete 是逐行删除自增id不会清空 truncate清空数据,自增id会从1开始计数
delete from classroom where cid =7;
insert into classroom(cname,description) values('bd1910','des')
#truncate清空数据,自增id会从1开始计数,文件级别的清空
truncate table classroom;
#修改
update classroom set description ='描述' where cid =2;