Added function to fetch all rows from the tables