querying databases with sql 3511229