Modified select to support selection of default database