DISTINCT in MySQL — How It Works

What the MySQL DISTINCT function does, with an example.

Published October 22, 2026

DISTINCT removes duplicate rows from a result set based on the selected columns.

Key points

  • Part of standard SQL functions available in MySQL for working with query results

Example

SELECT DISTINCT category FROM products;
More SQL articles