1 CREATE database schoolInfo;//首先创建数据库schoolInfo 2 3 use schoolInfo;//使用数据库schoolInfo 4 5 CREATE TABLE teacherInfo( //创建teacherInfobiao 6 id INT(4) NOT NULL UNIQUE PRIMARY KEY AUTO_INCREMENT, 7 num INT(10) NOT NULL UNIQUE, 8 Name VARCHAR(20) NOT NULL, 9 Sex VARCHAR(4) NOT NULL, 10 Birthday DATETIME, 11 Address VARCHAR(50) 12 ); 13 14 ALTER TABLE teacherInfo MODIFY name VARCHAR(30) NOT NULL;//将teacherInfo的表name字段 15 16 的数据类型改为BAECHAR(30) 17 18 ALTER TABLE teacherInfo MODIFY birthday DATETIME AFTER name;//将birthday字段的位置改 19 20 到sex字段的前面 21 22 ALTER TABLE teacherInfo CHANGE mumtid INT(10) NOT NULL;//将num字段名改为t_id 23 24 ALTER TABLE teacherInfo DROPaddress;//将teacherInfo表的address字段删除 25 26 ALTER TABLE teacherInfo ADD wasges FLOAT;//在teacherInfo表中增加名为wages的字段,数 27 28 据类型为FLOAT 29 30 ALTER TABLE teacherInfo RENAME teacherInfo lnfo;//将teacherInfo表改名为teacherInfo 31 32 Info 33 34 ALTER TABLE teacherInfo ENGINE = MyISAM;//将teacherInfo表的存储引擎更改为MyISAM