Yash Dwivedi Yash Dwivedi - 1 year ago 422
SQL Question

What does COUNT(*) do in MySQL

SELECT exam_board, COUNT(*)
FROM subjects
GROUP BY exam_board;

This is a block of code where 'exam_board' is a field in a table called 'subjects'.

What does each line of code in this block do?

Answer Source

Gives you the count of total number of records fetched in query.

In your specific case, it will give you count of each exam_board group.

exam_board  count
A           10
B           29

Something like this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download