MYSQL query statement subquery syntax error

query the student numbers of students who have not taken all courses

idea: students whose counting items are less than the course number mean that they have not learned all the courses

< table > < thead > < tr > < th > s_id < / th > < th > c_id < / th > < th > s_mark < / th > < / tr > < / thead > < tbody > < tr > < td > 01 < / td > < td > 01 < / td > < td > 80 < / td > < / tr > < tr > < td > 01 < / td > < td > 02 < / td > < td > 90 < / td > < / tr > < tr > < td > 01 < / td > < td > 03 < / td > < td > 99 < / td > < / tr > < tr > < td > 02 < / td > < td > 01 < / td > < td > 70 < / td > < / tr > < tr > < td > 02 < / td > < td > 02 < / td > < td > 60 < / td > < / tr > < tr > < td > 02 < / td > < td > 03 < / td > < td > 80 < / td > < / tr > < tr > < td > 03 < / td > < td > 01 < / td > < td > 80 < / td > < / tr > < tr > < td > 03 < / td > < td > 02 < / td > < td > 80 < / td > < / tr > < tr > < td > 03 < / td > < td > 03 < / td > < td > 80 < / td > < / tr > < tr > < td > 04 < / td > < td > 01 < / td > < td > 50 < / td > < / tr > < tr > < td > 04 < / td > < td > 02 < / td > < td > 30 < / td > < / tr > < tr > < td > 04 < / td > < td > 03 < / td > < td > 20 < / td > < / tr > < tr > < td > 05 < / td > < td > 01 < / td > < td > 76 < / td > < / tr > < tr > < td > 05 < / td > < td > 02 < / td > < td > 87 < / td > < / tr > < tr > < td > 06 < / td > < td > 01 < / td > < td > 31 < / td > < / tr > < tr > < td > 06 < / td > < td > 03 < / td > < td > 34 < / td > < / tr > < tr > < td > 07 < / td > < td > 02 < / td > < td > 89 < / td > < / tr > < tr > < td > 07 < / td > < td > 03 < / td > < td > 98 < / td > < / tr > < / tbody > < / table >

s_id student number, c_id course number
query sentence is as follows:
select b.s_id from school.mark b where (count (b.s_id) group by b.s_id) < count (distinct b.c_id);
syntax error, do not know how to change

Sep.02,2021

Group By + Having

select b.s_id from school.mark b group by b.s_id having count(b.s_id)  < count(b.c_id)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eacc9b-2101.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eacc9b-2101.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?