February 8, 2011 at 7:16 pm
nadabadan (2/8/2011)
... Snip ...
Computer science theory background? What the hell is bubble tree logic? Hardware buffer usage? You are just writing nonsense to sound intelligent. The algorithm I was referring to is the simple algorithm every computer science student has to solve. Given a set, finding the max or min value.
... snip ...
To this specific point. From an earlier post of yours
The interviewer wasn't asking what is the best or even a good way to find the min/max value. When you are forced to use a CASE statement, you have to implement a basic algorithm for finding the maximum or minimum values of a set/list. If you have a computer science background, I think you will have an appreciation for this question. Any basic data structures and algorithms book would have something like this
Thus, my discussing it directly, and none of those items are far fetched for anyone who has gone through a computer science course, especially not at the theoretical level.
Since you are unfamiliar, allow me to point you in the right direction:
Bubble Sort:
http://en.wikipedia.org/wiki/Sorting_algorithm#Bubble_sort
Buffer swap (google is littered with questions but little easily found references):
Graphical (usually used in regards to gaming or media): http://books.google.com/books?id=bfcLeqRUsm8C&pg=PA4&lpg=PA4&dq=programming+%22buffer+swap%22&source=bl&ots=FpYub_tVet&sig=0sX2A17Q5biPZ1-fzRjv-X65kXA&hl=en&ei=efdRTdWeLouusAPo_ri-Bg&sa=X&oi=book_result&ct=result&resnum=6&ved=0CDkQ6AEwBQ#v=onepage&q&f=false
Memory (in regards to speed of cpu buffers, the largest unit of memory a chip can work with):
http://en.wikipedia.org/wiki/Cache#The_difference_between_buffer_and_cache
Pathfinding (gaming AI):
http://www.policyalmanac.org/games/aStarTutorial.htm
Please note, since you like the term, A* is an algorithm. CASE is a statement, or a method of determining the algorithm.
Since I've addressed those immediate concerns, I'll stop helping to hijack the original thread.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
February 8, 2011 at 8:07 pm
Okay, I have read all the posts in this thread and I have come to a conclusion:
My answer to the interviewer would simply be another question: Why? Using the MAX function is the best way to determine the maximum value in a given column. There is no reason to try and develop a method using the CASE function (and yes, per BOL, CASE is a function not a statement).
February 8, 2011 at 10:25 pm
Craig Farrell (2/8/2011)
nadabadan (2/8/2011)
The only reason I'm up-in-arms is because others( you and GSquared mainly ) are up-in-arms about a simple interview question. To me, this interview question is a simple benign question with some merits.I guess it's perception then, having been through many interviews. A question like this is usually loaded. In the first case it's the technical interviewer trying to show off. In the second it indicates a 'Job for Bob'. Usually some strange, off the wall questions that really are non-standard except in extreme exceptions, presented as standard case, that you can't answer easily so they can prove 'no candidate but Bob can do the job'.
Your comment about Job for Bob is really strange to me for it never ever occurred to me to work in a company whose their people compromise a thoroughly fitted person for the sake of Jack or Jill that is odd really odd.
If neither of these are the case, then it's probable that the interviewer is looking for one of two answers. A real answer he got off the internet because he found some neat 'trick' and can use it as a technical question, or the candidate responding: "Why, are your customers complaining that queries are running too quickly?"
So why ask this question?
My issue exactly.
To me, it shows an interviewer how much an interviewee know about T-SQL, how much the interviewer knows about basic query execution, how much the interviewer knows about basic algorithm and whether or not the interviewer is able to think.
If you want to show thought, there's many other more accurate approaches that doesn't test your ability to do things the 'wrong way'.
Now if the interview question was "Our company believes the CASE statement is the best way to find the max column value of a table, so show us how you would use the CASE statement to find the max value.", then I'd agree with your "outrage". But that's not what the question is, is it.
The question is poor regardless of the desire to use it in the context of SQL Server. You've gone off on computer science theory backgrounds (what A* pathfinding, Bubble tree logic, and hardware buffer usage has to do with coding in SQL Server is beyond me...) and algorithmic methodology after I simply mentioned the word. Yet, you have yet to mention what it shows, in SQL Server, other than the ability to show you can puzzle out bad ways to do things. What specific items does this question highlight that you can't arrive at without using poor practices?
To quote you directly:
Take a deep breath and think about the question and WHAT the question is trying to get at.
Try this yourself. It's getting at one thing: Can you figure out how to code in SQL badly?
If you want to test an interviewee in design, the way they think, and their proficiency in T-SQL, there are other, simpler ways, even using the same topic. For example: Describe to me three ways to find the most recent row from a single table with a datetime field, and describe to me the methods you'd use to determine which was fastest for your specific case.
Similar question (requires a MAX on the datefield), yet derives much more information and you avoid completely poor coding requirements that don't make sense to anyone who regularly works with it.
February 9, 2011 at 12:45 am
nadabadan (2/8/2011)
If you have a computer science background, I think you will have an appreciation for this question.
I have a background in computer science engineering.
I do not appreciate the question.
nadabadan (2/8/2011)
The difference between me and you is that I understand WHY this question was asked. You do not.
Tom is a (very) experienced interviewer.
Are you?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 9, 2011 at 1:11 am
nzngh (2/8/2011)
Your comment about Job for Bob is really strange to me for it never ever occurred to me to work in a company whose their people compromise a thoroughly fitted person for the sake of Jack or Jill that is odd really odd.
Ah, took me a few re-reads to find your comment in there, nz.
The "Job for Bob" scenario usually occurs due to Visa requirements. In the states, for Work Visa renewals, it's necessary for an interview process to have occurred so that a company can prove it needs to keep the non-citizen in the states for work since there are no applicable candidates locally.
It can also occur for nepotistic reasons to keep certain government watchdog parties happy but that's rare.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
February 9, 2011 at 4:41 am
I have, on several occasions, asked stupid or trick questions of potential co-workers during the interview process. I want to see how they react, how seriously they take the question, and how long it takes them to answer me.
I much prefer people who aren't afraid of the answers "I don't know" or "I've never done that and probably never would" rather than people who scramble to please me because it's an interview. That gives me a good assessment of their self-confidence level. And the tone / speed in which they deliver that response gives me a good indication of their arrogance levels (depending on what the question was).
So, I could totally see this question being asked in an interview not to get an actual solution, but to see how the interviewee thinks.
February 9, 2011 at 7:56 am
nadabadan (2/8/2011)
GSquared (2/8/2011)
nadabadan (2/8/2011)
GSquared (2/7/2011)
nzngh (2/6/2011)
It was an Interview question, surly I couldn't answer it. I have tried it in any possible way that I know but I got only Null though with two column of min and max it works and give me min and max but having only one column nop.My reply would be, "Why would I use an oddball solution like that when Min and Max are built for that kind of thing? Building code that follows common, standard practices makes it easier to document and maintain. Building code with 'tricks' that nobody knows makes it more difficult on everyone, including me. So why would I do something like that?"
I see three possibilities here:
1. A prior dev/DBA used oddball tricks like that, and everyone currently working there hates it, and it's a "trick question" to see if you'd continue practices that everyone hates.
2. The person doing the interview uses oddball tricks like that, either out of miseducation, ego gratification, or "job security".
3. The company or department has policies that force them to use oddball coding practices, probably due to Pointy-Haired-Boss Syndrome.
If it's either 2 or 3, you don't want to work there anyway. If it's 1, then my reply would get a good reaction.
Or how about if you want to see how much a person REALLY knows about T-SQL or want to see their thought process. I doubt these people actually use the CASE statement to find the MAX value. But forcing someone to write a solution using CASE shows whether that person has some experience in T-SQL or just some superficial knowledge of T-SQL gleaned of a book the night before the interview.
If that's the answer to my question about oddball solutions, then I'll point them to this site, where they can see dozens of my posts that include T-SQL solutions I've come up with.
And no one would be impressed. Take a deep breath and think about the question and WHAT the question is trying to get at. Do you really believe anyone would implement a CASE method over a MAX function? Your 3 possibilities are a joke. Did you throw a hissy fit when your math teacher asked you to put away your calculator for a test on long division. Someone answering "SELECT MAX( columnid ) FROM table" reveals nothing to interviewer. But having someone implement an ALGORITHM to find the maximum value tells me that the interviewee has a good grasp of T-SQL, the underlying logic and implementation and has an ability to think.
And in real life, outside of the academia you probably live in, my method of handling questions like this resulted in 6 out of 6 interviews last Fall resulting in job offers.
100% of the time, my handling of this works. That makes my solution good enough for me.
We have different standards. I want a solution that gets the best results in the most efficient manner. You want to test for ability to comply with academic rules that don't have any real use, but which you believe will give you some form of insight into something. Both are valid in their correct settings.
Nobody with any research skills at all has any difficulty determining whether I know T-SQL "superficially" or "...ha[ve] a good grasp of T-SQL, the underlying logic and implementation and ha[ve] an ability to think". It takes about five minutes to determine that if the interviewer has ever heard of Google, and has read my resume. If they can't be bothered to do something practical like that as part of the preparation for interviewing me, then I honestly don't want to work for them. It means they have no real grasp of how to deal with real world issues, which means they will inevitably be a really poor manager.
So, your argument holds up well in a purely academic setting, where results are less important than methodology, but fails, or at least works less well, outside of that setting. I'm not in an academic setting. Hence, no, my three options are not a joke. They are urgent, critical, even vital considerations on whether a job is going to be worth obtaining, or should be skipped for something better. I have options in this regard.
One of the key differences here is that, in a test of long division (to use your example), I don't use a calculator because the teacher is the one who sets the rules, and those rules can be, and often are, as arbitrary as he/she desires. In the world of interviewing for jobs, the interviewer can set arbitrary rules, but in doing so, will alienate a practical realist like me, and will thus lose out on the possibility of obtaining access to my skillset. This has actually happened, where I rejected an opportunity to work for someone who thinks the way you do, and am very happy with the choice I made to work in a more results-oriented venue.
I will, however, suggest that you learn a little more diplomacy. You should realize that your response to me is a response to a successful, highly skilled, highly paid, experienced professional, and thus tone down the references to hissy fits, the laughability of my thought process, et al. Ad hominem attacks are unprofessional on your part, and show a lack of knowledge of debate and logic.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 9, 2011 at 8:06 am
nadabadan (2/8/2011)
Not entirely sure why you're up in arms over this one, nadabadan. It might just be the way I'm reading your writing style. Either way:
The only reason I'm up-in-arms is because others( you and GSquared mainly ) are up-in-arms about a simple interview question. To me, this interview question is a simple benign question with some merits. Using the CASE statement instead of MAX would not be best practices. That much is OBVIOUS to me and I'm sure it was OBVIOUS to the interviewer. So why ask this question? To me, it shows an interviewer how much an interviewee know about T-SQL, how much the interviewer knows about basic query execution, how much the interviewer knows about basic algorithm and whether or not the interviewer is able to think. Now if the interview question was "Our company believes the CASE statement is the best way to find the max column value of a table, so show us how you would use the CASE statement to find the max value.", then I'd agree with your "outrage". But that's not what the question is, is it.
I'm not up in arms about it. I just consider that the question gives more insight into the person asking it than into the person answering it.
You should note that my response to it would be ask why they were asking it. If they are using it to determine whether I can comply with arcane coding rules that violate best practices (which has been my usual experience with this kind of question), then I want to know why. Are they hoping that I can solve a real problem created by a (hopefully prior) employee? That would be a good case for me to take the job, since I like a challenge that way. On the other hand, are they asking it because they actually use solutions like this, and want to be sure I will too, then I'm out of there, so long and thanks for the opportunity to interview with you, I hope you find someone who will fit in better, I parked my car over here. If they want to use it to somehow determine whether I know enough about T-SQL to solve arcane and obscure problems, then pointing them to real solutions I've proposed for real problems, in real businesses, is a better way to answer that. It saves both of us some time, gives them ample material to review, and will give them real insights into my personality, problem solving skills, solution-vector methodology, et al. They want to test if I can go to highway speeds, and I show them that I'm breaking the sound barrier. That's better for them and for me.
That's not "up in arms", that's practical and real and works.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 9, 2011 at 7:05 pm
The algorithm which computer science students should be learning (to get the max of a set) is one of
MaxOfSet S U {x} = Reduce lambda x y : [ x > y ? x ; y ] S x
There are many algorithms that computer science students "should" learn to get the max of a set. Are we assuming that the list only contains numbers or letters? What about list contain objects where > doesn't apply. Shouldn't we abstract that algorithm out a bit. Make it a bit more robust.
Let's say that you ask an interviewee to write a function in lisp to get the max of a list without using built-in max function or external standard libraries. The interviewee says "why bother, a built-in max function already exists and it is best practices to use the built-in max function". Is he right to think you are an idiot. Would GSquared be correct to assume the following about you?
1. A prior dev/DBA used oddball tricks like that, and everyone currently working there hates it, and it's a "trick question" to see if you'd continue practices that everyone hates.
2. The person doing the interview uses oddball tricks like that, either out of miseducation, ego gratification, or "job security".
3. The company or department has policies that force them to use oddball coding practices, probably due to Pointy-Haired-Boss Syndrome.
Couldn't there be another possibility? That you want to see what the interviewee REALLY knows and what he REALLY understands?
Also, take a look at mr. mgoo's solution and the algorithm you listed. See anything familiar?
Code1
SELECT MAX( BidPrice ) FROM items
Code2
DECLARE @MaxPrice DECIMAL(14,2);
SET @MaxPrice = 0.00;
SELECT
@MaxPrice = CASE
WHEN COALESCE(BidPrice,0.00)>@MaxPrice THEN BidPrice
ELSE @MaxPrice
END
FROM items
Do you think that a person who could write code2 would not know about the MAX function? Do you really believe someone who could write code2 would actually use code2 to get the MAX value?
February 9, 2011 at 7:23 pm
And in real life, outside of the academia you probably live in, my method of handling questions like this resulted in 6 out of 6 interviews last Fall resulting in job offers.
Not in academia. I do real DBA work for a real company. Another one of those assumptions terribly gone wrong.
We have different standards. I want a solution that gets the best results in the most efficient manner. You want to test for ability to comply with academic rules that don't have any real use, but which you believe will give you some form of insight into something. Both are valid in their correct settings.
Didn't anyone teach you about assuming? I too want a solution that gets the best result in the most efficient manner. Your not special in this matter. Everyone wants the same thing. I have never used the CASE "expression" to find the MAX value. But any moron off the street could write "SELECT MAX( column ) FROM table". In an interview, I would like to see if the person was able to understand how MAX could be implemented. How it "works".
Nobody with any research skills at all has any difficulty determining whether I know T-SQL "superficially" or "...ha[ve] a good grasp of T-SQL, the underlying logic and implementation and ha[ve] an ability to think". It takes about five minutes to determine that if the interviewer has ever heard of Google, and has read my resume. If they can't be bothered to do something practical like that as part of the preparation for interviewing me, then I honestly don't want to work for them. It means they have no real grasp of how to deal with real world issues, which means they will inevitably be a really poor manager.
I'm sure your bosses just googled you and skipped those pesky interviews, tests and reference checks. Who the hell do you think you are?
One of the key differences here is that, in a test of long division (to use your example), I don't use a calculator because the teacher is the one who sets the rules, and those rules can be, and often are, as arbitrary as he/she desires.
Yeah, those "arbitrary" rules are there to test whether you can actually do long division.
In the world of interviewing for jobs, the interviewer can set arbitrary rules, but in doing so, will alienate a practical realist like me, and will thus lose out on the possibility of obtaining access to my skillset. This has actually happened, where I rejected an opportunity to work for someone who thinks the way you do, and am very happy with the choice I made to work in a more results-oriented venue.
Once again with your assumptions. You think you are the only "results-oriented" person? Only your company is a "results-oriented" venue? Most companies by their nature are results-oriented.
... Ad hominem attacks are unprofessional on your part, and show a lack of knowledge of debate and logic.
Ad hominem attacks are unprofessional, but so is building up a straw man argument. I'll also like to add that I have a fairly strong background in logic, having studied philosophy and all. You just had awful luck with your assumptions in this thread. Better luck on another thread I guess.
February 9, 2011 at 11:32 pm
nadabadan (2/9/2011)
bla bla bla
Ah. Glad you're back. This discussion is so much less entertaining without you.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 10, 2011 at 5:26 am
Koen, don't bait. You know better.
nadabadan, please remember this is a professional forum. You may not realize this, but your written word choices come off as defensive and argumentative, without the benefit of sounding like a true debate. Perhaps in a face-to-face verbal setting, saying what you've posted would seem less intense, but it's not working with the written word.
nzngh, since your question seems to be answered and this conversation appears to be devolving into a not-quite-flame war, I'm going to ask Steve to close the thread to further posting. If your question isn't answered, I apologize in advance for doing this.
February 10, 2011 at 1:19 pm
I can't see why are you attempting to close the discussion out of only one person crossing over. It could be solved by simply hinted him/her to not to do so. There have been many interesting comments and ideas about process of an interview and characteristics of Interviewer along with technical solutions. all were informational and useful some how.
Though I should say he/her is not exactly crossing over for there isn't a vivid line in the forums indicates the rules and regulations (in this sense at least). But as you said right it is better not to make it personal which may others are not interested in or for the people who search for this topic in the hope of finding answer.
February 10, 2011 at 1:31 pm
nadabadan:
We disagree on this. You have too much passion tied up in this method of questioning someone, and it's making you attack me in a way I don't feel needs to be perpetuated. I was not attacking you at any point, and was trying to keep this civil. I appoligize for whatever it was I did that offended you. Since your posts mainly seem to be attacks on me, I recommend ignoring what I write so as to avoid getting so emotionally upset by it.
nzngh:
I appologize if I've in any way contributed to derailing your thread. I was trying to post something helpful, but it apparently created a serious conflict for someone.
Obviously, there can be a lot of passion tied up in favorite methods of gaining insight into people.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 10, 2011 at 1:53 pm
nzngh (2/10/2011)
I can't see why are you attempting to close the discussion out of only one person crossing over. It could be solved by simply hinted him/her to not to do so.
This was tried.
Though I should say he/her is not exactly crossing over for there isn't a vivid line in the forums indicates the rules and regulations (in this sense at least). But as you said right it is better not to make it personal which may others are not interested in or for the people who search for this topic in the hope of finding answer.
I'll have to go look at the forum rules and FAQ. In general this is a professional forum. You approach others and topics the same way you would approach a co-worker. This includes debating the topic, not the person.
Telling me my ideas are bad and the reasons why and how, for example, is not only acceptable, but expected. It's why it's a public forum, and you can't learn a better way without that. Most regulars know I've gone toe to toe in debates here and lost a few times simply because they're right. I'm fine with that and better for it.
Telling me I'm an idiot (or other versions of that) FOR those ideas, or just "Your opinion sux" however, usually is not. We regularly beat on Celko for the same tactics, an implied flame of the person instead of the methodology.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
Viewing 15 posts - 31 through 45 (of 76 total)
You must be logged in to reply to this topic. Login to reply