Skip to main content
In RisingWave, a Top-N query includes a ranking function clause and a rank filtering condition. In the ranking function clause, you can include a PARTITION BY clause to fetch top N rows per group.

Syntax

The syntax of the ranking_function_clause is:
rank cannot be included in column_list.
You must follow the pattern exactly to construct a valid Top-N query.

Example

Create a table
Insert data
Run a top-N query