Boolean ifExists = false
String insertUser,strSql = " select user from emp
stmt . execute update(SQL);
while( stmt.next){
if(insertuser . equals(stmt . getstring(" user ")){
ifExists = true
Break;
}
}
If (if it exists) (
System.out.println ("User already exists");
} Otherwise {
string SQL = " insert into EMP values(" "+num+" ')"; stmt . execute update(SQL);
System.out.println ("Congratulations on joining successfully!" );
}