Specific Rows

We wish to obtain specific rows of a table by specifying their positions (row number).

Specific Rows

We wish to get specific rows from a table by specifying their position.

SELECT *
FROM refcon.dataset.table_1
    QUALIFY ROW_NUMBER() OVER () IN (1, 2, 4, 10);

Here is how this works:

  • ROW_NUMBER is a window function that ranks the rows of the table.
  • QUALIFY is used to filter the rows based on window function results.

Single Value

We wish to obtain the value of a particular column at a particular row. In this example, we wish to obtain the value of col_1 at row 3.

SELECT col_1
FROM refcon.dataset.table_1
    QUALIFY ROW_NUMBER() OVER () = 2;

Here is how this works:

  • ROW_NUMBER is a window function that ranks the rows of the table.
  • QUALIFY is used to filter the rows based on window function results.
SQL
I/O