Posts Tagged ‘SQL’

I had a situation today, I accidentally executed SQL insert script twice. The bad thing was that the table had no primary key or unique key defined which may have stopped it from execution. Lesson: Not having Primary keys is a bad idea So, now I can not delete each row manually so I had […]


Finding highest or lowest number in a column is easy, you can do that with max() and min() SQL function. But I had recently been asked in an interview to write a query that could find the second highest value in a table column. Ooops, and I didn’t do well in that interview either.LOL Before […]


I  had a situation, I wanted to find out all records in a single database table which occur more than once. In one of the database tables there were some records that were repeating and I wanted to get all those records, how many times were repeating etc. So here is the shortened version of […]