单例模式
饿汉式 class Singleton { private static Singleton instance=new Singleton(); private Singleton(){} static Singleton getInstance() { return instance; } } 懒汉式 class Singleton { private static Singleton instance=null; private Singleton(){} static Singleton getInstance() { if(instance==null) instance=new Singleton(); return instance; } }
sql语句
查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)