How to use count and distinct count in SQL query | Count vs Distinct Count | SQL interview question

Опубликовано: 24 Октябрь 2024
на канале: Your Analyst
72
6

For data analysis, we often encounter situations where we need to count the total number of rows.
while there are some situations where we need to count the distinct number of any specific column or parameter. SQL provides us a function to do the same.
We can use count function to count the total number of rows. At the same time, we can use count distinct function to count the distinct number of values for such rows.
In this short video, I have tried to explain how one can use count and distinct count function.

A simple code for the same is
Select count(customer_id)
from customers

and

Select count(distinct customer_name)
from customers

Also, this video has an example of how these can be used in different scenarios

tags: Excel, MS-EXCEL, SQL, MYSQL, T-SQL, SQL query, SQL tutorial, SQL for beginners, create table in SQL, SQL server, SQL database, datascience, data analytics, business analytics, Excel tips, SQL tips, SQL interview questions, SQL interview preparation, SQL hacks, Excel to SQL

#shortsvideo #sql #sqlinterviewquestionsandanswers #sqlinterview #sqlqueries #SQL #sqlqueries #businessanalytics #datascience #dataanalytics #shortsviral #SQLServer #sqltutorial #interviewquestions #interview #interviewprep
#analytics #Query #explore #reels #exploremore #shorts