d5 sql queries, untested