Moved sql commands