A pie chart is a circular chart that is divided into sectors that illustrate relative magnitude or frequencies. The arc length of each sector (and resulting area) is proportional to the quantity it represents. The sectors combined together create a full disk. These charts are effective in illustrating the allocation of a value between two or more groups. Pie charts should only be used when the sum of all the categories is meaningful, for example if they represent proportions.
We now want to create a pie chart from the dillsample database that displays the proportion of male and female employees. In order to accomplish this, we need to use an SQL COUNT function in order to sum the number of total employees. There are several other SQL aggregate functions that operate against a collection of values and return a single value (e.g. COUNT, SUM, etc.) - more information on SQL aggregate functions can be found at http://www.w3schools.com/sql/sql_functions.asp. For our pie chart, we will want to use the following SQL statement:
SELECT gender, COUNT(employeeid) FROM dillsample.employee GROUP BY gender
The GROUP BY clause is mandatory in order for the data to be properly arranged. A doughnut chart shares the same SQL format.