Salesforce Interview Question

sql query to find count of students having same last name

Interview Answers

Anonymous

Mar 21, 2014

select count(LastName) from employees group by LastName having count(*)>1

5

Anonymous

Sep 24, 2018

Select lastname, count(*) as lastnamecount from students group by lastname having count(*)>1

Anonymous

Oct 6, 2013

select * from Students where lastName in (select s1.lastName from Students s1 group by s1.lastName having count(*)>1);