How many unique?
But what if we want to calculate the number of unique site visitors? Sounds like a combination of selecting unique and then counting...
Yes, that's the point! To calculate the number of unique observations over a certain column use COUNT(DISTINCT( ... ))
statement. For example,
12SELECT COUNT(DISTINCT(user_id)) FROM visitors
This query will return a single value - the number of unique user_id
in the visitors
table.
Swipe to start coding
Count the number of different cars model
s in the audi_cars
table.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 2.63Awesome!
Completion rate improved to 2.63
How many unique?
But what if we want to calculate the number of unique site visitors? Sounds like a combination of selecting unique and then counting...
Yes, that's the point! To calculate the number of unique observations over a certain column use COUNT(DISTINCT( ... ))
statement. For example,
12SELECT COUNT(DISTINCT(user_id)) FROM visitors
This query will return a single value - the number of unique user_id
in the visitors
table.
Swipe to start coding
Count the number of different cars model
s in the audi_cars
table.
Lösning
Tack för dina kommentarer!
single
Awesome!
Completion rate improved to 2.63
How many unique?
Svep för att visa menyn
But what if we want to calculate the number of unique site visitors? Sounds like a combination of selecting unique and then counting...
Yes, that's the point! To calculate the number of unique observations over a certain column use COUNT(DISTINCT( ... ))
statement. For example,
12SELECT COUNT(DISTINCT(user_id)) FROM visitors
This query will return a single value - the number of unique user_id
in the visitors
table.
Swipe to start coding
Count the number of different cars model
s in the audi_cars
table.
Lösning
Tack för dina kommentarer!