got some SQL functionality to work