Question: why do you have two separate tables? Surely the simplest way of storing this data would be:
id, name, year
1, Sammy, 2005
2, Remmy, 2005
etc.
If there is a reason why you want to separate these out, you’ll need to associate the names table with the years table somehow. A better way would be like this:
table years (id, year)
1, 2002
2, 2003
3, 2004
4, 2005
5, 2006
table names (id, name, yearid):
1, Sammy, 4
2, Rammy, 4
3, Gamal, 5
4, Hany, 3
5, Wael, 3
6, Hady, 1
You would then join the tables like so:
SELECT id, name, year FROM names INNER JOIN years ON years.id = yearid
Then to select just the unique entries:
SELECT id, name, year FROM names INNER JOIN years ON years.id = yearid GROUP BY year HAVING COUNT(year) = 1
I haven’t tested it, but that should work.