adds console.log of database query