-4
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?

Ponnarasu
  • 635
  • 1
  • 11
  • 24
Yash Dwivedi
  • 71
  • 1
  • 5

2 Answers2

2

Gives you how much records have the same exam_board value for each different exam_board value.

For example, if your table has this data:

|exam_board|
 A
 A
 A
 B
 B

this query will return:

|exam_board |COUNT(*)
 A            3
 B            2
Waldson Patricio
  • 1,489
  • 13
  • 17
0

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.

gschambial
  • 1,383
  • 2
  • 11
  • 22