How can I create and update an onchain database in a plutus contract?

I just learning haskell and plutus now so I am a beginner in this.
I understand that plutus is purely functional, but if you have some complex onchain dapp you will have to manage some kind of database through side effects. Could someone provide some code examples about that?
For example how can I create a dictionary of key - value pairs and extend the dictionary or update the values every time when someone interacts with my dapp/smart contract?

1 Like