Skip to content
Advertisement

Setting commission for employees based on position

I just started to learn some sql and I am using oracle database 11g. The question I have is that I have a staff table where I am trying to update the commission for each staff based on the position of the staff. I wanted to update the commission for regular employees to be 0.04(4%) and 0.05(5%) for managers.

Is there a way to do this all in one statement?

The way I did it was that I just updated all the staff commission by :

then I did another update statement to update just the manger

I was thinking something along the lines of this however this wouldnt work lol.

Thanks for your help! much appreciated!

Advertisement

Answer

You may use a CASE expression here:

This assumes that you really want to do a blanket assignment to every non manager with a commission of 0.04.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement