In often use in TSQL the following query :
SELECT COUNT(*), * FROM CUSTOMER c WHERE c.Name like 'foo%';
When I try to execute this query in Oracle SQL Developer it doesn't work and throws me an error:
"Missing expression"
What is the good syntax ?
Thanks in advance.
SELECT COUNT(column_name) FROM table_name; The SELECT statement in SQL tells the computer to get data from the table. COUNT(column_name) will not include NULL values as part of the count. A NULL value in SQL is referring to values that are not present in the table.
Since it doesn't matter which value you put in the parentheses, it follows that COUNT(*) and COUNT(1) are precisely the same. They are precisely the same because the value in the COUNT() parentheses serves only to tell the query what it will count.
This will perform better:
SELECT COUNT(*) OVER (), c.* FROM CUSTOMER c WHERE c.Name like 'foo%';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With