More work on SQL stuffs