Sie sind auf Seite 1von 81

Example 1

COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3

Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7

600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4

300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ --------

? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:

DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re

turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.

Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo

column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:

SELECT COUNT(*) FROM Employee;


Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t

he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1

COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4

700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3

500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2

100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)

------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;

Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee

GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes

them as nulls in the DeptNo column.


SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2

If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column

because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;

Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he

Employee table is reported:


SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;

Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee

GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY

clause groups results by department number.


SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3

Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7

600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4

300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ --------

? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:

DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re

turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.

Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo

column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:

SELECT COUNT(*) FROM Employee;


Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t

he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1

COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4

700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3

500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2

100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)

------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;

Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee

GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes

them as nulls in the DeptNo column.


SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2

If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column

because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;

Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he

Employee table is reported:


SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;

Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee

GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY

clause groups results by department number.


SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3

Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7

600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4

300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ --------

? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:

DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re

turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.

Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo

column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:

SELECT COUNT(*) FROM Employee;


Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t

he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo

ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.

SELECT DeptNo, COUNT(*) FROM Employee


GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1

COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4

700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3

500 7
600 4
700 3
Example 3
Example 1
COUNT(*) reports the number of employees in each department because the GROUP BY
clause groups results by department number.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Without the GROUP BY clause, only the total number of employees represented in t
he
Employee table is reported:
SELECT COUNT(*) FROM Employee;
Note that without the GROUP BY clause, the select list cannot include the DeptNo
column
because it returns any number of values and COUNT(*) returns only one value.
Example 2
If any employees have been inserted but not yet assigned to a department, the re
turn includes
them as nulls in the DeptNo column.
SELECT DeptNo, COUNT(*) FROM Employee
GROUP BY DeptNo
ORDER BY DeptNo;
Assuming that two new employees are unassigned, the results table is:
DeptNo Count(*)
------ -------? 2
100 4
300 3
500 7
600 4
700 3
Example 3

Das könnte Ihnen auch gefallen