Fixed errors in the sql usage