sql definition cleaned up