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

Show parent comments

1

u/kater543 Jun 19 '24

That’s an interesting perspective. I don’t know it off the top of my head, but if I needed to look up and use it, it wouldn’t be hard at all. You’re saying that I am still building an excuse not to learn it? I don’t see it personally as limiting to be fair, more along the lines of I don’t keep information I don’t use in my head at all times, but I could be wrong. What do you mean that it’s limiting me? Slightly confused by the comment.

-1

u/mikeblas Jun 19 '24

You didn't know it. You dismissed it as trivia, and explained why you didn't know it. That limits you. If, instead, you vowed to study and practice it, you'd learn it and you'd know it.

I don't know what comedian does this skit, but they point out that while driving on the highway, anyone driving faster than they are is a total lunatic and anyone driving slower than them is a moron. Of course, their speed is completely arbitrary. And variable, too!

I'm mostly kind of retired now, after about 35 years in the industry. But at 10 years or so, I hit a plateau. It drove me nuts. After some reflection, I realized I was applying that same skit to knowledge and skills. People who could solve problems that I couldn't solve were somehow wizards -- they were smarter than me because of genetics or luck or schooling; whatever it was, I couldn't be as good as they were no matter what I did. OTOH, people who couldn't solve problems that I could solve were morons. I thought the solutions were straightforward and obvious, and they must be dummies if they couldn't do it.

My assumption that I just couldn't learn more advanced techniques was severely limiting me. I over came that, did some research and studying, the techniques I thought were impossible were really within my grasp. Not hard to learn at all. (And I got a little more patient with the dummies, too.) This broke my lock and I was able to climb off the plateau I had built for myself.

Maybe it's just that you weren't careful with your words. But if you're dismissing things you don't know as "trivia", then you don't think they're important. In fact, they're useful. It's not hard to look things up, but the fewer things you need to look up, the faster you'll work and the broader your consideratons will be when analyzing problems or building solutions.

Hope that helps your confusion.

1

u/kater543 Jun 19 '24

I mean I think you’re confusing the issue here tbh. I don’t think I can’t do anything that others can do. I understand the basic concepts and foundational ideas and don’t think that the small details are important enough to be memorized, especially when I can look it up whenever I need to with tools that are becoming more and more prevalent nowadays.

Vowing to study and memorize each of these items would provide only a tiny incremental increase in efficiency that would most likely be better spent understanding other foundational concepts and general ideas.

To use your comedian example: it’s not that I think anyone driving faster than me is a lunatic, rather I know how to drive that fast and have done it before; I’m just working on improving my flying skills right now, but if need be I can get back in my racing gear with a quick refresher and be back at that speed with a quick “google search”.

I’m not dismissing the items as trivia either, rather I would say that memorizing each item is trivia because I can flip out the manual and look it up when need be.

I can see an argument that every item makes me faster and sometimes you need that speed and can’t look things up. However that situation is not only going to be rare, it’s going to not be useful when I’m perfecting my craft in racing cars when I need the basics to fly a plane and I can’t do that.

To go to your latter paragraphs, I don’t think I’ve hit a rut or plateau, in fact, I’m learning every day. It’s just not the things like “what is the default sort order for an order by” level of detail for SQL. If I some day become a SQL SME, a DBA or something similar, if SQL is my only tool and I need to have it super sharp, maybe then I’ll need to know the SQL handbook by heart. However my job isn’t just SQL. I need to focus on how to do data science, how to be a human, how to manage projects and people, how to tell stories and wow leadership with insights.

In short, I “dismiss” this as trivia because as a data analyst/scientist(or even if you were a programmer), this type of knowledge is trivia, it is not something that will make/break your work, it is not something that you can’t look up whenever you want. To dedicate extra time to memorize this will take up unneeded brain space.

I think this would be a situation in which I hear you, and I agree in some parts, but the specifics I wholly disagree with. Thank you for your explanation of your position and your opinion, always good to hear from different perspectives.

0

u/mikeblas Jun 20 '24 edited Jun 20 '24

I assure you that I'm not misunderstanding your situation at all -- at least to the extent that you've correctly represented it. The differences between RANK and DENSE_RANK, and between ASC and DESC are fundamental and not "trivia". Yet you're making more and more elaborate explanations for not learning (or knowing) about them.

1

u/kater543 Jun 20 '24 edited Jun 20 '24

Asc and desc I can understand(and absolutely know the difference between the two), but knowing which is the default when I type in asc and desc every time is as well?

Rank and dense rank are fundamental? In my 7 years of using SQL nearly daily I have had to write one rank over function. I am not going to remember the difference between rank over and dense rank off the top of my head. Do I know how to use rank and dense rank? Absolutely. Did I memorize exactly what the difference was and can call upon that knowledge without a quick refresher? No.

Is that such a huge gap in my knowledge? That I have used and can use these topics again, but that need to look it up and say “aha yes I remember” before I can explain it?

I would understand if it was something complex like implementing a neural net from scratch, that I can’t just quickly relearn, but something that can be relearned in a second doesn’t meet the standard?

That is why I am saying this is a trivia question, it’s a fact that I can learn in one second like “when were the pyramids made”

0

u/mikeblas Jun 20 '24

Is that such a huge gap in my knowledge?

Yes.

1

u/kater543 Jun 20 '24

If you say so. You are entitled to your opinion. Though do you sometimes think you’re projecting a bit there? Just a thought. Thanks for the insight.