Let’s consider a scenario, wherein requirement is to find out the percentage of a particular type of values from the single input set.
Below can be considered as an example of input sample data and need is to find out how much percentage of dev releases and how much percentage of prod releases are present in the input data.
In order to achieve the solution, one has to go through various steps as mentioned below:
So far we have got all the individual parts. The next task is to combine all the above mentioned 3 steps and generate a single result set and here comes the challenge.
As input set is holding only two columns, there is no common field in all the above mentioned three queries and as there is no commonality it is significantly difficult to bring such result set together to form a single result set.
Can’t we go ahead and introduce some new column just for the sake of projection? Well, let’s see how that changes our above 3 steps now:
Now comes the final step, wherein we need to bring all the above result set together to calculate the percentage.
Combining the individual results to get a single result.
On execution of the above steps, you will get the desired output as shown below:
Hope you enjoyed learning.