O'Reilly logo

Learning Storm by Anand Nalya, Ankit Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

MySQL queries

This section will explain how you can analyze or query the stored data to generate some statistics. We will cover the following types of statistics:

  • How to calculate the page hits from each country
  • How to calculate the count of each browser
  • How to calculate the count of each operating system

Calculating the page hits from each country

Run the following command on the MySQL console to calculate the number of hits on a page from each country:

select country, count(*) from apachelog group by country;

The output for the preceding command is as follows:

+---------------------------+----------+
| country                   | count(*) |
+---------------------------+----------+
| Asia/Pacific Region       |        9 |
| Belarus                   |       12 |
| Belgium                   |       12 |
| Bosnia and Herzegovina ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required