创建表
create table customers
(
cust_id int NOT NULL ATUO_INCREMENT, //自动对该列增量
cust_name char(50) NOT NULL DEFAULT 'xiaoming', //默认值
cust_email char(255) NOT NULL, //不可以为NULL
cust address char(50) NULL, //可以为NULL
PRIMARY KEY (cust_id) //主键,有多个时写在括号中用逗号隔开
)ENGINE = InnoDB;
更新表
添加一列
alter table vendors add vend_phone char(20);
删除一列
alter table vendors drop column vend_phone ;
删除表
drop table customer2;
重命名表
rename table customer2 to cust;
rename table backup_customers to customers,
backup_vendors to vendors;