Is it possible to retrieve list of Accounts which has more than 100 contacts associated to it using a single SOQL ?
I think I misinterpreted your initial question. You can filter on aggregations using the HAVING clause:
SELECT AccountId, count(Id) records FROM Contact GROUP BY Accountid HAVING count(Id) > 100
You should be able to retrieve at least 999 contacts using:
SELECT Name, (SELECT Id FROM Contacts) FROM Account WHERE ...
You can use simple query like--- SELECT Id, Name, ( SELECT Name, Email, BirthDate FROM Contacts ) FROM Account where Name='Anshul Arora'
Or you can use LIST in your class to achieve dynamic things Exp----
List acc= [SELECT Id, Name FROM Account];
System.debug('a' + alist);
List clist = [SELECT Id, Name FROM Contact WHERE Contact.AccountId IN :acc];
System.debug('c' + acc);