一、表的創建
create table 表名(
列名 列的類型【(長度) 約束】,
列名 列的類型【(長度) 約束】,
列名 列的類型【(長度) 約束】
);
二、表的修改
1.修改列名
alter table 表名 change column 列名 新列名
2.修改列的類型或約束
alter table 表名 modify column 列名 新類型
3.添加新列
alter table 表名 add column 新列的名字 類型
4.刪除列
alter table 表名 drop column 列名
5.修改表名
alter table 表名 rename to 新表名
三、表的刪除
drop table 表名
drop table if exists 表名
下面這個是如果有這個表就把他刪除
四、表的複製
1.僅僅複製表的結構
create table 表1 like 某個已經存在的表
2.複製表的結構和數據
create table newlist
select * from oldlist