Performing scan queries

You can run a query using Scan Queries via the YDB CLI by adding the -t scan flag to the ydb table query execute command.

Run the data query:

  1. ydb table query execute -t scan \
  2. --query "SELECT season_id, episode_id, title \
  3. FROM episodes \
  4. WHERE series_id = 1 AND season_id > 1 \
  5. ORDER BY season_id, episode_id \
  6. LIMIT 3"

Scan queries - 图1

Where:

  • --query: Query text.

Result:

  1. ┌───────────┬────────────┬──────────────────────────────┐
  2. | season_id | episode_id | title |
  3. ├───────────┼────────────┼──────────────────────────────┤
  4. | 2 | 1 | "The Work Outing" |
  5. ├───────────┼────────────┼──────────────────────────────┤
  6. | 2 | 2 | "Return of the Golden Child" |
  7. ├───────────┼────────────┼──────────────────────────────┤
  8. | 2 | 3 | "Moss and the German" |
  9. └───────────┴────────────┴──────────────────────────────┘

Scan queries - 图2