修改表 复制表

修改表

add     alter table 表名 add 字段名 类型[(长度),约束条件];

drop   alter table 表名 drop 字段名;

change   alter table 表名 change 原字段名 新字段名 类型[(长度),约束条件];

modify  alter table 表名 modify 字段名 类型[(长度),约束条件];

rename     rename table 旧表名 to 新表名;

复制表

  create table 新的表名 select * from 源表名;

  数据
  结构
  约束不能复制

当条件不成立是 只复制表结构
create table 新的表名 select * from 源表名 where 1 = 2;
create table stu_copy2 select * from student1 where 1 = 2;

3.蠕虫复制
自我复制
insert into 表名称 select *from 表名;
如果有主键 避开主键字段
insert into 表名称(其他字段) select 其他字段 from 表名;

sql注入攻击
一个了解sql语法的攻击者 可以在输入框输入sql语句

1255241708 123
select *from user where account = ":"drop database mysql" and pwd = "123";

猜你喜欢

转载自www.cnblogs.com/msj513/p/9996033.html
今日推荐