In SQL, how can you “group by” in ranges?

前端 未结 15 2400
粉色の甜心
粉色の甜心 2020-11-22 15:38

Suppose I have a table with a numeric column (lets call it \"score\").

I\'d like to generate a table of counts, that shows how many times scores appeared in each ran

15条回答
  •  没有蜡笔的小新
    2020-11-22 16:41

    Perhaps you're asking about keeping such things going...

    Of course you'll invoke a full table scan for the queries and if the table containing the scores that need to be tallied (aggregations) is large you might want a better performing solution, you can create a secondary table and use rules, such as on insert - you might look into it.

    Not all RDBMS engines have rules, though!

提交回复
热议问题