Study Vault Search notes, aliases and full text
Graph
ConceptDBISProofread

group-by(T, cols, agg)

The group-by operation partitions a table's rows by the values of the grouping columns and returns one row per group, with an aggregation function applied to each aggregated column.

  • T=(C,D,R)T = (C,D,R) is an arbitrary table with kk columns (∣C∣=k|C| = k)
  • cols is a sequence (g1,...,gm)(g_1,...,g_m), where each gj∈{1,...,k}g_j \in \{1,...,k\}
  • agg is a sequence ((a1,f1),...,(an,fn))((a_1,f_1), ..., (a_n, f_n)) of pairs, where each aj∈{1,...,k}a_j \in \{1,...,k\} and each fj:P(Daj)→Daj′f_j: \mathcal{P}(D_{a_j}) \rightarrow D'_{a_j} is a function

Result: a table T′=(C′,D′,R′)T' = (C', D', R'), where#

  • C′=(cg1,...,cgm,ca1,...,can)C' = (c_{g_1}, ..., c_{g_m}, c_{a_1},...,c_{a_n})
  • D′=(Dg1,...,Dgm,Da1′,...,Dan′)D' = (D_{g_1}, ..., D_{g_m}, D'_{a_1},...,D'_{a_n})
  • R′=(rg1,...,rgm,ra1′,...,ran′):r∈project(T,(g1,...,gm),T)R' = (r_{g_1}, ..., r_{g_m}, r'_{a_1},...,r'_{a_n}): r\in project(T, (g_1, ..., g_m), T) and raj′=fj({raj′′:(r1′′,...,rk′′)∈R ∣ ∀j:rgj′′=rgj}r'_{a_j} = f_j(\{r''_{a_j}: (r''_{1},..., r''_k) \in R\ |\ \forall j: r''_{g_j} = r_{g_j} \}

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only