1 votes 1 votes Databases sql databases + – shubhamdarokar asked Jan 10, 2017 • edited Aug 7, 2017 by Bikram shubhamdarokar 835 views answer comment Share Follow See all 17 Comments See all 17 17 Comments reply Sushant Gokhale commented Jan 14, 2017 reply Follow Share is it all 10 tuples? 0 votes 0 votes shubhamdarokar commented Jan 14, 2017 reply Follow Share no. Ans is 4 0 votes 0 votes Sushant Gokhale commented Jan 14, 2017 reply Follow Share See this: Executed the above query at http://sqlfiddle.com/ So, for the above question, it should be 10. 0 votes 0 votes shubhamdarokar commented Jan 14, 2017 reply Follow Share but they have declared marks as string not int 0 votes 0 votes Sushant Gokhale commented Jan 14, 2017 reply Follow Share ............. 0 votes 0 votes Sushant Gokhale commented Jan 14, 2017 reply Follow Share I think they are using strcmp(). So, inner query returns 7, 9, 8, 6, 9, 8. So, the tuples having marks less than above are 14,12, 15, 19. Great question bro !!!!!!! Keep posting such questions. 0 votes 0 votes shubhamdarokar commented Jan 14, 2017 reply Follow Share this is what they have done.See if this helps.I did not understand it though. 0 votes 0 votes Sushant Gokhale commented Jan 14, 2017 i edited by Sushant Gokhale Jan 14, 2017 reply Follow Share I got it. Thanks bro for your help :) I had misunderstood the question 0 votes 0 votes shubhamdarokar commented Jan 14, 2017 reply Follow Share nope thank u 0 votes 0 votes Sushant Gokhale commented Jan 15, 2017 reply Follow Share you understood it, right? 0 votes 0 votes Rahul Jain25 commented Jan 15, 2017 reply Follow Share 19 should not be smaller than 18 bcoz even tey have 1 at start but sql then will compare 8 and 9 i think and answer should be 5. Great question. 0 votes 0 votes Sushant Gokhale commented Jan 15, 2017 reply Follow Share Rahull.....4 is correct. Look at my comment above. 0 votes 0 votes Rahul Jain25 commented Jan 15, 2017 reply Follow Share I looked at your comment but sql doesn't compare string like that. Check this link http://stackoverflow.com/questions/5980783/sql-between-clause-with-strings-columns 0 votes 0 votes Sushant Gokhale commented Jan 15, 2017 reply Follow Share @Rahul. Yes, the same thing as ASCII comparison is stated on that site. But for 19 value , the person is not BTECH :) 0 votes 0 votes Rahul Jain25 commented Jan 15, 2017 reply Follow Share Didn't see that. My bad. 0 votes 0 votes shubhamdarokar commented Jan 15, 2017 reply Follow Share yes i got it 1 votes 1 votes saxena0612 commented Aug 8, 2017 reply Follow Share @sushant : Could you please tell us that how strcmp works is it that it compares the very first part of two digit values and if it is less then it wont go futher? 0 votes 0 votes Please log in or register to add a comment.