various sql snippets