minor sql work