This is a noob question - apologies.
Suppose I have a smart contract that allows people to register something with an ID. For example, my public address is o4f... and I want to register the ID 012345 to my public address.
Later on I make a transaction where someone buys that ID from me, so now the ID 012345 belongs to a different public address, say 05f....
My question is: can I treat Ethereum like a database and ask the blockchain to give me all transactions that involved the ID 012345? What would that look like?