SQL Query to find employees that have same name and age?

There are following way to find employees that have same name and age from Oracle database.

  • Here first we have created one employee table.
  • In that table there are 5 column id, name, age, address and salary.

           Select * from Employee;

same name and age

Using group by and count() :-

Select name, age, count(*) from Employee group by name, age having count (*) > 1;.

  • Here we are grouping the name and age.
  • Now count function return the number of rows that have same name and age.find name and age