Skip to content

[BUG] - <缺陷标题> 测试用例不完善 #21509

@PPPeriBae

Description

@PPPeriBae

LeetCode 用户名

PPPeriBae

问题号码、标题和链接

1280.学生们参加各科测试的次数 https://leetcode.cn/problems/students-and-examinations/description/?envType=study-plan-v2&envId=sql-free-50

Bug Category

缺少测试用例 (由于缺少测试用例而接受不正确/低效的代码)

描述

202432420434
测试用例提供的科目已经按照字典序排好,导致代码不需要对科目字段进行排序就可以通过测试用例。

你使用的语言

MySQL

你提交或者运行的代码

select stu.student_id ,stu.student_name,
sub.subject_name,
count(ex.subject_name) as attended_exams 
from Students as stu
cross join Subjects as sub
left join Examinations as ex
on sub.subject_name=ex.subject_name and stu.student_id=ex.student_id
group by stu.student_id,sub.subject_name
order by stu.student_id

期望行为

建议修改Subjects中科目顺序,可修改为
Subjects table:
+--------------+
| subject_name |
+--------------+
| Physics |
| Math |
| Programming |
+--------------+

屏幕截图

202432420434

额外的上下文

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions