首页 > 试题广场 >

假设存在学生信息表student,选修课表course,如果

[不定项选择题]
假设存在学生信息表student,选修课表course,如果想查询所有学生的选修课以及成绩,下面正确的sql语句是:
create table `student`(
    `id` int(11) not null auto_increment,
    `name` char(50) not null comment '学生姓名',
    `sid` int(11) not null comment '学号',
    primary key(`id`),
    unique key `sid`(`sid`)
)engine = innodb;
create table `course`(
    `id` int(11) not null auto_increment,
    `name` char(50) not null comment '课程名称',
    `score` int(11) not null comment '成绩',
    `sid` int(11) not null comment '学号',
    primary key(`id`)
)engine = innodb;

  • select student.name, course.name, course.score from student left join course on student.sid = course.sid
  • select student.name, course.name, course.score from student right join course on student.sid = course.sid
  • select student.name, course.name, course.score from student inner join course on student.sid = course.sid
  • select student.name, course.name, course.score from student cross join course where student.sid = course.sid
inner join与cross join中不含null值
发表于 2022-03-20 21:25:09 回复(0)
B选项为啥不对呀
发表于 2021-09-07 15:51:52 回复(0)