Query for redesigned database tables and sample app