MySQL 练习 创建表格2

|--需求说明

#实践课,使用SQL语句创建成绩表
#要求:在数据库myschool中,使用SQL语句创建成绩表result,result的结构表见书上

 

|--实现思路

采用创建表的语句完成

 

|--代码内容

#实践课,使用SQL语句创建成绩表
#要求:在数据库myschool中,使用SQL语句创建成绩表result,result的结构表见书上
use myschool;  #切换到myschool这个数据库中
show tables;  #看下myschool里面有多少个表,其中有没有result这个表
create table if not exists `result`(
  `studentNo` int(4) not null comment'学号',
    `subjectNo` int(4) not null comment'课程编号',
    `examDate` datetime not null comment'考试日期',
    `studentResult` int(4) not null comment'考试成绩'
    );
    
desc result; #查看表结构,观察是否和预期一致
使用SQL语句创建成绩表

 

|--运行结果

 

转载于:https://www.cnblogs.com/twuxian/p/11347360.html