Queries generator for database inputs