创建数据库:
create database test; 创建表:
CREATE TABLE test(
id int(11) UNSIGNED not null AUTO_INCREMENT,
name varchar(30) not null comment '姓名',
age int(10) not null comment '年龄',
PRIMARY KEY ( detection_id )
) comment '人员表';
增加字段:
alter TABLE test add mobile varchar(30) UNSIGNED not null DEFAULT 0 COMMENT "手机号码";
创建视图:
CREATE VIEW view_name AS select_statement;
删除表:
DROP TABLE tbl_name;
删除视图:
drop view if exists view_name;
删除字段:
alter table table_name drop column name;
修改表名:
rename table test to demo;
修改数据库字段:
ALTER TABLE `test` CHANGE COLUMN `id` `uid` int() UNSIGNED not null comment "用户id";
Comments | NOTHING