modified .sql file to make changes for optional queries in querydesign question