1.修改数据表:
修改表名:alter table 旧表名 rename 新表名;
添加字段:alter table 表名 add 字段名 列类型 [属性];
修改字段:alter table 表名 change 旧字段名 新字段名 列类型 [属性];
删除字段:alter table 表名 drop 字段名;
2查看表:desc 表名;
3.添加主键
alter table 表名 add constraint 主键名
primary key 表名(主键字段);
4.添加外键
alter table 表名 add constraint 外键名
foreign key(外键字段)
references 关联表名(关联字段);
DQL语句
select <字段名列表>
from<表名或视图>
[where <查询条件>]
[group by <分组的字段名>]
[having <条件>]
[order by <排序的字段名> [ASC或DESC]]
5.limit子句
select <字段名列表>
from<表名或视图>
[where <查询条件>]
[group by <分组的字段名>]
[having <条件>]
[order by <排序的字段名> [ASC或DESC]]
[limit [位置偏移量] 行数];
注:MySQL查询语句中使用limit子句限制结果集