Data mining is one of the emerging fields in research and information retrieval. Data mining tools requires data in the form of data set. Data set preparation is one of the important tasks in data mining. Data set is collection of data which is stored in relational database where database schema is highly normal-sized. To analyze data efficiency, data mining systems are widely using datasets with columns in horizontal tabular layout. The two main components of SQL code is joining and aggregation Vertical aggregations have limitations to build data sets because they return one column for aggregated group using group functions.