Method create_query