Preparing a data set for analysis is generally the most time-consuming task in a data mining project, requiring many complex SQL queries, joining tables, and aggregating columns. In general, a significant manual effort is required to build data sets, where a horizontal layout is required. Here introduces simple, yet powerful, methods to generate SQL code to return aggregated columns in a horizontal tabular layout, returning a set of numbers instead of one number per row. This new class of functions is called horizontal aggregations. An aggregation function with a grouping technique gives query optimizers an opportunity of providing different query evaluation plans. For queries with a non-distributive aggregation function, evaluation cannot be performed until the entire input is constructed. This delays the entire computation. Aggregation functions of this type are called holistic aggregation functions. To improve the evaluation performance of holistic aggregation function, an approach called partial aggregation can be used. Partial aggregation performs computations in an incremental way and increases the speed of computation.