Bird
0
0

Which function would you use if you want to assign ranks without gaps even when there are ties?

easy📝 Conceptual Q2 of 15
SQL - Window Functions Fundamentals
Which function would you use if you want to assign ranks without gaps even when there are ties?
ADENSE_RANK()
BRANK()
CROW_NUMBER()
DCOUNT()
Step-by-Step Solution
Solution:
  1. Step 1: Identify function behavior for gaps in ranks

    RANK() creates gaps after ties, so it is not suitable.
  2. Step 2: Identify function that assigns ranks without gaps

    DENSE_RANK() assigns ranks consecutively without gaps even if there are ties.
  3. Final Answer:

    DENSE_RANK() -> Option A
  4. Quick Check:

    No gaps in ranks = A [OK]
Quick Trick: Use DENSE_RANK for consecutive ranks without gaps [OK]
Common Mistakes:
  • Choosing RANK() expecting no gaps
  • Confusing ROW_NUMBER() with ranking functions
  • Using COUNT() which is unrelated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes