SQL corrections