r/SQL • • Jun 19 '24

Discussion I got rekt in a SQL interview today

Just thought it was hilarious and I wanted to share: I was asked a few very easy SQL questions today during a phone screen and I absolutely bombed two basic ones.

I use SQL every day and have even taught SQL classes, but I never really learned the difference between rank and dense rank because I use neither in dealing with big values(just use row number). I remembered seeing the answer to that question on this very subreddit earlier too, I just didn’t remember it because it was so obscure to me. Curious how y’all have used rank and dense rank.

Also I messed up the default order by direction because my brain apparently no worky and I always type in either “asc” or “desc” out of habit anyway.

SQL trivia shudders

Nightmare for a daily user and sql guy.

435 Upvotes

342 comments sorted by

View all comments

6

u/DoseTheHoneyBadger Jun 19 '24

I only use dense_rank() in interviews. I know the difference only because of interview prep.

1

u/kater543 Jun 19 '24

I can see that it can be useful(there was that really cool example by someone with student terms) but like I definitely agree and don’t think it’s an essential IMO. Usually when you work in the business world it’s all about who’s number 1-5, not the 10 people tied at number 4.

2

u/DoseTheHoneyBadger Jun 19 '24

Exactly. Who’s the top N by X metric. There almost never a tie when it comes to sales, gb consumption , etc