trdsql Aggregation
COUNT(*)
First is COUNT(*). You can count the total number of cases.
When using aggregate functions, the original row and column data is not output, and the aggregated result is output from there.
The following example does not look like a CSV because the result is one line, but it is output as a one-line, one-column CSV with a header.
Details
Although it simply counts the number of cases, care must be taken not to include the number in the interpretation of the header.
You can specify a search condition. This is used when you want to know the number of cases that match the search condition.
COUNT(column name)
COUNT(column name) is also often used. In RDBMS, NULL is excluded, so it is used to distinguish it from COUNT(*).
Also, when COUNT and DISTINCT are combined, the number of cases excluding duplicates can be output.
Let’s run it with the following CSV file.
Aggregate functions can also be executed at once.