单例模式
饿汉式
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)
本文介绍了单例模式的两种实现方式:饿汉式和懒汉式,并提供了一个SQL语句实例,用于查找数据库表中基于特定字段的重复记录。
202

被折叠的 条评论
为什么被折叠?



