Count number of times value appears in particular column in MySQL Count number of times value appears in particular column in MySQL mysql mysql

Count number of times value appears in particular column in MySQL


select email, count(*) as c FROM orders GROUP BY email


SELECT column_name, COUNT(column_name)FROM table_nameGROUP BY column_name


Take a look at the Group by function.

What the group by function does is pretuty much grouping the similar value for a given field. You can then show the number of number of time that this value was groupped using the COUNT function.

MySQL Documentation

You can also use the group by function with a good number of other function define by MySQL (see the above link).

mysql> SELECT student_name, AVG(test_score)    ->        FROM student    ->        GROUP BY student_name;