Sql select most repeated value
In this video we will discuss one of the common SQL interview questions. Write a SQL query to select the most repeated column value. If you understand GROUP BY
in SQL, this query is very easy to write. After you answer this question, the interviewer may ask the following related question as well to check your understanding of GROUP BY
and HAVING
.
The key to answer these questions is understanding GROUP BY and HAVING in SQL. If you are new to these 2 concepts, please click here to learn about SQL Group By and Having
SQL query to select the most repeated column value
SQL query to find a value that is repeated n number of times
n could be any value, 2 times, 5 times, 10 times, 1 million times etc.
Please note : To filter SQL groups we use HAVING
not WHERE
© 2020 Pragimtech. All Rights Reserved.