Query editor
WITH deltas AS (SELECTtype AS output_type,COUNT(*) AS count_delta,SUM(value) AS amount_deltaFROM bitcoin.outputsWHERE type != 'nulldata'GROUP BY typeUNION ALLSELECTtype AS output_type,-COUNT(*) AS count_delta,-SUM(value) AS amount_deltaFROM bitcoin.inputsWHERE NOT is_coinbaseAND type != 'nulldata'GROUP BY type),utxos AS (SELECToutput_type,SUM(count_delta) AS utxo_count,SUM(amount_delta) AS amountFROM deltasGROUP BY output_type)SELECToutput_type,utxo_count,100.0 * utxo_count / SUM(utxo_count) OVER () AS percentage_of_count,amount,100.0 * amount / SUM(amount) OVER () AS percentage_of_amountFROM utxos;