You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50 students for various subjects.
You need to ensure that the following requirements are met:
Students must be ranked based on their average marks.

If one or more students have the same average, the same rank must be given to these students.

Ranks must be sequential without gaps in between.

Which Transact-SQL query should you use?
A:

B:

C:

D:

E:

F:

G:

H:

Correct Answer: B
Explanation/Reference:
Explanation:
The DENSE_RANK function returns the rank of each row within a result set partition, with no gaps in the ranking values. The rank of a specific row is one plus the number of distinct rank values that come before that specific row.
References: https://docs.microsoft.com/en-us/sql/t-sql/functions/dense-rank-transact-sql?view=sql-server-
2017