---
title: "Finding the exclusive records in a table"  
description: "Finding the exclusive records in a table"  
author: "Revati S Misra"  
published: 2023-07-27  
updated: 2023-07-28  
canonical: https://www.mindstick.com/forum/159326/finding-the-exclusive-records-in-a-table  
category: "database"  
tags: ["database", "database table"]  
reading_time: 2 minutes  

---

# Finding the exclusive records in a table

Finding the exclusive [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) in a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap)

## Replies

### Reply by Aryan Kumar

Sure, you can find the exclusive records in a table using the `DISTINCT` keyword and the `WHERE` clause. The syntax is as follows:

SQL

```plaintext
SELECT DISTINCT column_name
FROM table_name
WHERE condition;
```

For example, the following SQL statement will find all exclusive records in the `products` table where the `price` column is greater than 100:

SQL

```plaintext
SELECT DISTINCT price
FROM products
WHERE price > 100;
```

This will return a list of all unique prices in the `products` table where the price is greater than 100.

Here is an example of how to find the exclusive records in a table in MySQL:

SQL

```plaintext
CREATE TABLE products (
  id INT NOT NULL AUTO_INCREMENT,
  name VARCHAR(255) NOT NULL,
  price INT NOT NULL,
  PRIMARY KEY (id)
);

INSERT INTO products (name, price) VALUES
('Product 1', 100),
('Product 2', 200),
('Product 3', 300),
('Product 4', 400),
('Product 5', 500);

SELECT DISTINCT price
FROM products
WHERE price > 100;
```

This will return the following result:

```plaintext
200
300
400
500
```

As you can see, the `DISTINCT` keyword has returned all unique prices in the `products` table where the price is greater than 100.

Here are some additional things to keep in mind when using the `DISTINCT` keyword:

- The `DISTINCT` keyword can be used with any column.
- The `DISTINCT` keyword will only return unique values.
- You can use the `WHERE` clause to filter the results of the `DISTINCT` keyword.


---

Original Source: https://www.mindstick.com/forum/159326/finding-the-exclusive-records-in-a-table

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
