Interview Question: Select only Prime numbers from table

As part of my daytime job, I conduct professional interviews for candidates. For that, I’m always on the search for good interview questions. I regard a good question if it’s not too complicated, has a number of ways to solve, and if needed, can be solved programmatically with SQL or C / C# / JAVA languages.

Now that I’m done with asking the prime number question (I need to change questions every now and then), I thought I will post the solution here.

(more…)