Join queries are not working as expected when trying to compare a count result with a value

Join queries are not working as expected when trying to compare a count result with a value

I'm learnin SQL from a book and i'm trying to do some exercices on join queries.The only problem that i'm facing is that all of my join queries are not working while they seem well

I'm learnin SQL from a book and i'm trying to do some exercices on join queries.The only problem that i'm facing is that all of my join queries are not working while they seem well


students(student_id,student_names,student_age)
courses_students(course_id,student_id)
courses(course_id,course_schedule,course_room,teacher_id)
teachers(teacher_id,teacher_names)


The query is "which courses have more than 5 students enrolled?"

Here is what i've done :


SELECT course_name,
       count
  (SELECT count(*)
   FROM courses) AS COUNT
FROM students,
     courses,
     courses_students
WHERE students.student_id=courses_students.student_id,
      courses.course_id=courses_students.course_id
  AND COUNT > 5


And the other one is what are the names of students enrolled in at least 2 courses scheduled for the same hours

My query :


SELECT student_name,
       schedule
FROM students,
     courses,
     courses_students
WHERE students.student_id=courses_students.student_id,
      courses.course_id=courses_students.course_id
  AND COUNT > 2


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

MySQL Database Bootcamp: Go from SQL Beginner to Expert | Simpliv

MySQL Database Bootcamp: Go from SQL Beginner to Expert

SQL Full Course - SQL Tutorial For Beginners - MySQL Essentials - SQL Training

This SQL Full Course video will cover all the topics of SQL starting from scratch. This video is great for beginners who want to learn SQL and for advanced people to brush up their skills.

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts|Simpliv

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts