|--需求说明
/*实践课,在数据库myschool中用SQL语句创建课程表subject,subject表格的数据结构见图片*/
|--实现思路
使用创建表格的语法
|--代码内容
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
/*实践课,在数据库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'年级编号' );
|--运行结果