![]() ) AS NumberOfEmployeesPaidSubAverageWages WHERE Salary < (SELECT AVG(Salary) FROM Employees) The other statistic can be generated as a simple value in the select-list via a sub-query: SELECT COUNT(*) AS NumberOfEmployees, ![]() But COUNT(*) is more conventional and less reliant on the optimizer. A good optimizer will recognize that Employee_ID is a primary key and contains no NULL values, and the query will be the same. ![]() What's the difference between COUNT(*) and COUNT(Employee_ID)? The difference is that the latter only counts the rows where there is a non-NULL value in the Employee_ID column.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |