Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ClickHouse launches Claude-powered Agents and House Mates partner program at Open House 2026 Read more →
rank ウィンドウ関数のドキュメント
rank () OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column] [ROWS or RANGE expression_to_bound_rows_withing_the_group]] | [window_name]) FROM table_name WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
CREATE TABLE salaries ( `team` String, `player` String, `salary` UInt32, `position` String ) Engine = Memory; INSERT INTO salaries FORMAT Values ('Port Elizabeth Barbarians', 'Gary Chen', 195000, 'F'), ('New Coreystad Archdukes', 'Charles Juarez', 190000, 'F'), ('Port Elizabeth Barbarians', 'Michael Stanley', 150000, 'D'), ('New Coreystad Archdukes', 'Scott Harrison', 150000, 'D'), ('Port Elizabeth Barbarians', 'Robert George', 195000, 'M'), ('South Hampton Seagulls', 'Douglas Benson', 150000, 'M'), ('South Hampton Seagulls', 'James Henderson', 140000, 'M');
SELECT player, salary, rank() OVER (ORDER BY salary DESC) AS rank FROM salaries;
┌─player──────────┬─salary─┬─rank─┐ 1. │ Gary Chen │ 195000 │ 1 │ 2. │ Robert George │ 195000 │ 1 │ 3. │ Charles Juarez │ 190000 │ 3 │ 4. │ Douglas Benson │ 150000 │ 4 │ 5. │ Michael Stanley │ 150000 │ 4 │ 6. │ Scott Harrison │ 150000 │ 4 │ 7. │ James Henderson │ 140000 │ 7 │ └─────────────────┴────────┴──────┘
このページは役に立ちましたか?