
/* Preventing users creation of duplicate in Salesforce*/
trigger PreventDuplicateNameAccount on Account (before insert, before update) {
//Preparing Account names in Set from trigger.new
Set<String> nameSet = new Set<String>();
for(Account acc : trigger.new){
nameSet.add(acc.Email__c);
}
// getting the list of accounts in database with the account name we entered ( trigger.new)
List<Account> accList = new List<Account>(
[select id,name, Email__c from Account where Email__c in: nameSet]);
for(Account a : trigger.new){
if(accList.size() > 0 )
a.addError('Accounts Email already exists in your Organization with Email '+a.Email__c);
}
}

This is truely a nice catch dear. However, is there any way to handle more than 50K data?Thanks!