SQL: Count rows in a table without COUNT()
Use a dummy column⌗
- Add a dummy column to all rows with value as 1.
- Print the sum of this dummy column to count the rows.
SELECT SUM(ROW_COUNT) AS COUNT
FROM (
SELECT NAME, 1 AS ROW_COUNT
FROM EMPLOYEE
);
Read other posts
Discuss Post