sql updates

There are some unnecessary commit information but they are removed so PR only consists of the sql updates sorry for the inconvenience caused.