---
title: "How to count all unique records in the SQL table?"  
description: "How to count all unique records in the SQL table?"  
author: "Ashutosh Patel"  
published: 2023-03-22  
updated: 2023-03-22  
canonical: https://www.mindstick.com/forum/157534/how-to-count-all-unique-records-in-the-sql-table  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 1 minute  

---

# How to count all unique records in the SQL table?

How to [count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct) all [unique](https://www.mindstick.com/blog/12870/how-to-be-unique-in-business) [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) in the [SQL table](https://www.mindstick.com/forum/160519/how-can-i-update-sql-table-by-dataset-data-in-ado-dot-net)?

## Replies

### Reply by Krishnapriya Rajeev

We can count all unique records in a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) using the *DISTINCT* keyword in conjunction with the *COUNT()* aggregate function.

The DISTINCT keyword in a query retrieves different and non-repeating values.

The COUNT() function returns the number of rows selected by a query.

![How to count all unique records in the SQL table?](https://www.mindstick.com/mindstickforums/f4a29d39-9bb9-4ffc-ac9d-fd7383bd7216/images/954d56b3-0844-425a-aad0-bd7783fa20b0.png)


---

Original Source: https://www.mindstick.com/forum/157534/how-to-count-all-unique-records-in-the-sql-table

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
