Interview Questions.One of the Interview I have faced I was give a query to write,here is the tableId Value
1 10
1 0
2 12
2 12
3 0
4 0I was asked to find the total number of consumed and unconsumed ids,following is the output tableId Consumed Unconsumed
1 1 1
2 2 0
3 0 1
4 0 1 As we can see consider Id 1 in the output table it has value 1 for consumed column and 1 for unconsumed column,because total number of Ids with value 1 are 2 and one id with value 1 has value greater than 0 and second one has value equal to 0 in the input table.so the conditon is consumed ids are ids whose value is greater than 0 and unconsumed ids are ids whose value is equal to zero.i was asked to write query to generate the following output,I have found many difficulties and was not able to solve during the interview.the interviewer gav