• Skip to primary navigation
  • Skip to content
  • Skip to footer
Thomas Ngo Thomas Ngo
  • Home
  • Journal
  • Tags
  • About

    Thomas Ngo

    Software Engineer

    • Stanton, California
    • Email
    • GitHub
    • Resume

    SQL problem - Classes More Than 5 Students

    February 19, 2024 less than 1 minute read

    Page Navigation

    • Problem
    • Query
    • Editorial Solution
      • Approach: Group By

    Problem

    problem-596

    Query

    SELECT
        class
    FROM Courses
    GROUP BY class
    HAVING COUNT(student) >= 5
    

    Editorial Solution

    Approach: Group By

    SELECT
        class
    FROM
        (SELECT
            class, COUNT(student) AS num
        FROM
            courses
        GROUP BY class) AS temp_table
    WHERE
        num >= 5
    ;
    

    Tags: SQL

    Updated: February 19, 2024

    Share on

    Twitter Facebook LinkedIn
    Previous Next

    You may also enjoy

    Problem of The Day: N-th Tribonacci Number

    January 25, 2026 less than 1 minute read

    Problem Statement

    Problem of The Day: Combination Sum III

    January 25, 2026 1 minute read

    Problem Statement

    Problem of The Day: Letter Combinations of a Phone Number

    January 23, 2026 2 minute read

    Problem Statement

    Problem of The Day: Find Peak Element

    January 20, 2026 less than 1 minute read

    Problem Statement

    • Follow:
    • GitHub
    • LinkedIn
    © 2026 Thomas Ngo.