Skip to content

Update SQL query for student report.sql based on grade rules #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions Basic Join/The Report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ Write a query to help Eve. */
-- URL: https://github.com/Pavith19
--

SELECT ID, Name, Marks, Grade
FROM Students AS s
JOIN Grades AS g ON s.Marks
BETWEEN g.Min_Mark AND g.Max_Mark;
SELECT
CASE
WHEN g.grade < 8 THEN 'NULL'
ELSE s.name
END AS name,
g.grade,
s.marks
FROM students s
JOIN grades g
ON s.marks BETWEEN g.min_mark AND g.max_mark
ORDER BY
g.grade DESC,
CASE
WHEN g.grade < 8 THEN s.marks
ELSE s.name
END ASC;