|--需求说明
/*实践课,在数据库myschool中用SQL语句创建课程表subject,subject表格的数据结构见图片*/
|--实现思路
使用创建表格的语法
|--代码内容
/*实践课,在数据库myschool中用SQL语句创建课程表subject,subject表格的数据结构见图片*/ use myschool; drop table if exists `subject`; #检查该表格是否已经存在,如果存在就删除,重新创建 create table if not exists `subject`( `subjectno` int(4) not null primary key auto_increment comment'课程编号', `subjectname` varchar(50) comment'课程名称', `classHour` int(4) comment'学时', `gradeID` int(4) comment'年级编号' );
|--运行结果