I am learning SQL and am at a dead end, which should be a simple query. I have a table with the following template:
Id | Type
------------
1 | Red
2 | Blue
3 | Blue
4 | Red
..
I would like to write a query to return a table that counts the total number of instances of each type and returns a table with the following pattern, for example, if “Blue” appears in 12 rows and “Red” in 16 rows in the table above, the result would be:
Blue | Red
-----------
12 | 16
source
share