Answer: Aggregate Records Using COUNT
Find a detailed explanation of using the COUNT function to aggregate records in a table using SQL query.
We'll cover the following...
Solution
The solution is given below:
Press + to interact
/* The query to find the count of exams missed */SELECT COUNT(*) AS AbsentStudentsFROM StudentGradesWHERE Marks IS NULL;
Explanation
The explanation of the solution code is given below:
Line 2: The
SELECT
query uses theCOUNT(*)
function to count the number of rows in the table. We useAS
to set an alias for the column.Line 3: The
FROM
clause specifies the table,StudentGrades
.Line 4: In the
WHERE
clause, we specified the condition to filter the data. TheIS NULL
keyword is used specifically to check if the value isNULL
.
Recall of relevant concepts
We have covered the following concepts in this question: ...