Cloudflare D1 icon

Cloudflare D1

Execute operations against Cloudflare D1 serverless databases. Supports structured operations (Insert, Select, Update, Delete), raw SQL queries, and can be used as a tool by AI Agents.

Query Builder → Get Distinct Values

AI-generated

Summary

Retrieve distinct values from a specified column in a database table.

Inputs

  • databaseId (required) — The unique identifier of the Cloudflare D1 database to query.
  • builderTable (required) — The table from which to retrieve distinct values, selected from the available tables list.
  • distinctColumn (required) — The column to extract distinct values from; choose from the column list or provide an expression.

Output shape

Array of distinct values from the selected column

The response payload contains a 'values' field with the list of distinct values; other fields indicate success and metadata.

Examples

Example 1: Get unique usernames from the users table

databaseId: ; builderTable: users; distinctColumn: username

Example 2: Find distinct status codes in a logs table

databaseId: ; builderTable: logs; distinctColumn: status_code

Example 3: List distinct categories for products

databaseId: ; builderTable: products; distinctColumn: category

Discussion