I’m trying to move some logics of my web shop application to database engine, so I figured that counting price of cart would be a good start. So I have a relation shown below with Cart_product table having foreign keys with Buyer and Product. The total price of cart for each user would be the price of each product in Cart_product multiplied by it’s amount.
How and with what can I achieve this ? Trigger, procedure, cursor ? Any help appreciated.

would return how much each user’s bought. What you do with it from there is up to you.
For a specific user: