change code into raw sql