Populate tables from database.