I'm confused by how exactly Bitcoin transaction are calculated. A transaction contains inputs and outputs, and if its inputs exceed its outputs the difference is deemed as the transaction fee.
So, if I just mined a block and received 25 coins in reward, there were no previous transactions related with my address and I want to make a transfer of 0.001 Btc using my 25 Btc balance. Then, there will be a 25 Btc input and a 0.001 Btc output, and the difference in the amount of 24.999 Btc all goes to miners?! Please help me understand.