Added sql queries for the complete (for now) set of tables as well as dynamic table generation