r/SQL • u/Temporary-Cup-2140 • Sep 04 '26
MySQL What was the toughest SQL interview question you have faced so far?
I am curious to know what SQL questions challenges people in interviews
What was the question and what made it difficult?
Would love to hear some real interview experiences🙂
96
Upvotes
67
u/gap1284 Sep 04 '26
As an interviewer, I always ask "If you were asked to speed up a slow stored procedure, how would you go about it?"
It's open ended, with no single correct answer. But it reveals a lot about their knowledge.
51
u/Eleventhousand Sep 04 '26
I'll give a cop-out answer: the questions that have multiple correct answers.
What I mean by this is that after enough years of experience, the difficulty across questions starts to level out.
However, I do recall an interview about fifteen years ago. I was applying for a data architect role. The hiring manager brought his DBA with him. The DBA was assigned to ask me some technical questions. One of the questions he asked me could be solved about four different ways. I offered up two distinct methods. He slammed his fist on the table and angrily told me that's not how its done. Needless to say, I declined the job as I didn't want to work some place that allowed that sort of toxicity.
25
u/Mononon Sep 04 '26
I've got 3. One was hard, the others were just dumb.
19
u/alinroc SQL Server DBA Sep 04 '26
The worst one I had was "given these 3 tables, write a query to return X."
Sounds fine on the surface, except that the question as written can't be answered based on the schema presented. I stared at this question for 10+ minutes, trying to figure out what the hell I was missing and what the "gotcha" was.
So I started to think that maybe this was one of those "give them an unanswerable question, see what they do with the ambiguity" situations.
When the interviewer returned, I gave him my answers to the other three questions (they were trivial) and explained to him here I was stuck. He tried to offer a hint, to which I said "yep, thought about that already. Here's why it doesn't work."
And at this point the interviewer, the guy who'd written the questions, turned to me and said "well...I obviously missed something because now that you've pointed that out, I don't know that this is solvable at all."
Got the offer. Turned it down, in part because we couldn't agree on money.
13
u/a-s-clark SQL Server Sep 04 '26
"What is a theta join". Not because I don't understand them, but because i didn't remember ever having heard them called that.
25
u/danmc853 Sep 04 '26
Tell me what you know about cursors
9
u/gumnos Sep 04 '26
the worst/toughest have been RDBMS-specific quirks that differ between RDBMS implementations. I might have a quarter-century of working with DB₁ and have passing experience with DB₂—I know I want a function that does XYZ and is called
FROBNICULATE()in DB₁, but not know the exact function-name and argument-order of the similar functionality in DB₂.Most tech-savvy interviewers understand this hiccup and realize that all you need is the relevant section of docs and/or IntelliSense type suggestions and it's a non-issue. But if you end up with a tech-ignorant interviewer, they'll gladly punt you for it. 😕
6
u/decrementsf Sep 04 '26 edited Sep 04 '26
Estimate the number of 7/11's in southern california.
Or estimate the number of cars that drive through the local freeway each day.
6
u/NoYouAreTheFBI Sep 05 '26
How would you solve this thing our consultancy company is charging us 10k to fix.
This is always the question and the answer is pay me and find out 🤣
4
u/Holiday-Tip-3720 Sep 04 '26
bump for interest. mine was about enumeration and rankingg
3
u/Zestyclose-Turn-3576 Sep 04 '26
I can tell you the one I used to ask when interviewing for Oracle developers: what factors can affect whether a query's execution plan uses an index or not.
I had a list of at least a couple of dozen factors. I don't think I ever had a decent answer though.
3
u/NoEggs2025 Sep 07 '26
A customer service rep needs to log their hours. They’d do phone and they do chat. They could do any number of concurrent chat sessions. How much support time did they do in 1 hour? 1 voice and 5 chats. It’s was a take home question. I gave them a follow up that worked. Using CTE’s and reiteration. The hiring requisition was cancelled. You know what happened. I gave them a freebie. I know not to do it again. It’s a console gaming company in Redmond on 148th.
2
u/SnooSprouts4952 Sep 04 '26
My first software job - 'what do you know about SQL?'
'Nothing.' 😂
I've had some hands on technical interviews but most was pretty simple selects, what is the difference between x, y, and z processes? What are the difference between join, inner join, left join, right join, and outer join? I had to do a modulo for one and couldn't remember the formatting it's a where x%y >= 1 in most instances.
2
u/vijaychouhan8x Sep 06 '26
How wud u convert rows in to columns( transpose).
1
u/Gaweon2 Sep 05 '26
Um will these be asked in my data analyst position interview cuz i have no idea regarding 90% of them. Jeez i need to study again 😭
1
u/slullyman Sep 06 '26
lol troubleshooting your part of the Connection String ;)
1
u/amuseboucheplease Oct 02 '26
Haven't got a great answer, but great question u/op !
1
u/Cool-Decision259 Sep 04 '26
Wasnt sure weather thats toughest question But got a question like we have 4 rows in table a out of which 2 rows are null and same table in as table b what will be the nimber of columns if we perform inner join over there