Oracle database report statistics tool

Data report statistics

Originally, when doing reports, I often had a headache about this data aggregation, because the database is stored in rows, and when we often do statistics, we need two dimensions of statistics, and finally add a total. It is painful when there is no idea.

Artifact case...when...

Case...when... and decode in oracle can produce the effect of conditional conversion. The data can be converted into 0 and 1 according to certain conditions. In this way, in conjunction with the sum function, the row data can be summarized into column data.

rollup function

This is a bit the same as the group grouping function. It performs grouping statistics on the result set, but this grouped fields are combined and grouped.
Such as the packet field is A, B, C
it will A,B A,C B,C A,B,Cthree packets total.

with...as...function

This function is equivalent to a temporary table, used to store the data result set, equivalent to a reference to a result set, the data that needs to be extracted needs to be filtered, which can improve efficiency.

Guess you like

Origin blog.csdn.net/qq125281823/article/details/106786987