Various database code snippets