IT: Count All in SQL

How to find a count for data inside a column in SQL:

Example: How many flavors were introduced each year?

Select year_first_offered, count(*) as flavors_introduced_each_year FROM ICECREAM group by year_first_offered;

SQL> Select year_first_offered, count(*) as flavors_introduced_each_year FROM ICECREAM group by year_first_offered;

YEAR_FIRST_OFFERED FLAVORS_INTRODUCED_EACH_YEAR

—————— —————————-

2010                            2

2001                            2

1998                            1

1981                            2

2015                            1

1976                            1

1961                            1

2012                            4

1992                            1

9 rows selected.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s