Fetch data from the database