# RANK

A window function assigning equal rank to peers and leaving gaps after ties.

## What is **RANK** in a relational database?

**RANK** — A window function assigning equal rank to peers and leaving gaps after ties.

```sql
SELECT student_id,
       RANK() OVER (ORDER BY score DESC) AS score_rank
FROM exam_result;
```

Level: Journeyman · [More Database terms at this level](https://www.ask-codey.com/glossary/subjects/database/journeyman)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/rank
