select count (*)as cnt from employees group by salary having cnt>3

 If you want to count the number of employees who have the same salary and have more than 3 employees with that salary, you can use the COUNT, GROUP BY, and HAVING clauses together. Here's how you can write the SQL query:


SELECT Salary, COUNT(*) AS cnt FROM Employees GROUP BY Salary HAVING COUNT(*) > 3;

This query will count the number of employees for each unique salary value, and it will only include those salary values where the count of employees with that salary is greater than 3.

No comments:

Post a Comment

How to host application on server new way

 copy the htacess from public to root copy the server.php from public to root but rename to index.php htacess <IfModule mod_rewrite.c>...