Monday, 21 July 2014

SELECT QUERIES: Small Tricky SQL SERVER Queries Interview Questions and Answers SET-9

SET-9
Objective Type :Small Tricky SQL SERVER Queries Interview Questions and Answers for experienced and fresher
Hey here I come with tricky sql query which are frequently asked in sql/database interview for puzzle sql developer. This would be best for you to go through following sql server interview queries before attend interview. This series contain 17th Objective type Interview Questions(Sql server query), all query seems easy but it would be complex situation when you face these query in Interview time.

So following query seems very easy but play roll of complex/tricky sql query.

So lets start(see answers in end of this post)
83). SELECT 15
--output of this query would be.
A). Throw error
B). 15
C). 0
D). 1

84).SELECT $
--output of this query would be.
A). Throw error
B). $
C). 1
D). 0.00

85). SELECT COUNT(*)
--output of this query would be.
A). Throw error
B). 0
C). 1
D). *

86). SELECT COUNT('7')
--output of this query would be.
A). Throw error
B). 7
C). 0
D). 1

87). SELECT 'VIKAS' + 1
--output of this query would be.
A). Throw error
B). 'VIKAS'
C). VIKAS
D). VIKAS1

88).SELECT 'VIKAS' + '1'
--output of this query would be.
A). Throw error
B). 'VIKAS'
C). VIKAS
D). VIKAS1

89).SELECT (SELECT 'VIKAS')
--output of this query would be.
A). Throw error
B). 'VIKAS'
C). VIKAS
D). VIKAS1


90).SELECT SELECT 'VIKAS'
--output of this query would be.
A). Throw error
B). 'VIKAS'
C). VIKAS
D). VIKAS1


91). SELECT * FROM 'Country'
--output of this query would be.
A). Throw error
B). Select all data from country table
C). Country
D). Throw error

92). SELECT * FROM Country , EmployeeDetail
--output of this query would be.
A). Throw error
B). Output will be cross join of both tables
C). Output will be inner join
D). Output will be only Country table data


93). SELECT COUNT(*) + COUNT(*)
--output of this query would be.
A). Throw error
B). 0
C). 1
D). 2

94). SELECT 'VIKAS' FROM Country
--output of this query would be.
A). Throw error
B). Display one time "VIKAS"
C). Display "VIKAS" as many rows in Country table
D). Will select country table data

95).SELECT SUM(1+2*3)
--output of this query would be.
A). Throw error
B). 9
C). 7
D). 6

96). SELECT MAX(1+2*3)
--output of this query would be.
A). Throw error
B). 3
C). 7
D). 6

97).SELECT MAX(1,3,4)
--output of this query would be.
A).Throw error
B). 1
C). 3
D). 4

98).SELECT MAX('VIKAS')
--output of this query would be.
A).Throw error
B). 1
C). 2
D). VIKAS

99).Select Count(SELECT CountryID FROM Country)
--output of this query would be.
A).Throw error
B). Will display count of country table
C). 0
D). 1

100). SELECT 1 + '1'
--output of this query would be.
A). Throw error
B). 1
C). 2
D). 11
101). SELECT '1' + 1 
--output of this query would be.
A). Throw error
B). 1
C). 2
D). 11


102). SELECT NULL + 5
--output of this query would be.
A). Throw error
B). NULL
C). 5
D). 0


103). SELECT NULL + '1'
--output of this query would be.
A). Throw error
B). NULL
C). 1
D). 0


104). SELECT 1 WHERE NULL = NULL
--output of this query would be.
A). Throw error
B). NULL
C). 1
D). NOTHING WILL RETURN BY This (0 rows will be returned by this) because the condition is false


105). SELECT SUM(1)
--output of this query would be.
A). Throw error
B). NULL
C). 1
D). 0

106). SELECT SUM('1')
--output of this query would be.
A). Throw error
B). NULL
C). 1
D). 0


107). SELECT SUM(NULL)
--output of this query would be.
A). Throw error
B). NULL
C). 1
D). 0

108). SELECT 6/0
--output of this query would be.
A). Throw error(Divide by zero error encountered.)
B). NULL
C). 1
D). 0

109). SELECT 0/0
--output of this query would be.
A). Throw error(Divide by zero error encountered.)
B). NULL
C). 1
D). 0

110). SELECT 0/9
--output of this query would be.
A). Throw error(Divide by zero error encountered.)
B). NULL
C). 1
D). 0

Click here for be continue


ANSWERS :
110) D 109) A 108) A 107) A 106) A 105) C 104) D 103) B 102) B 101) C 100) C 99) A 98) D 97) A 96) C
95) C 94) C 93) D 92) B 91) A 90) A 89) C 88) D 87) A 86) D 85) C 84) D 83) B
Visit Our New Site for HR Interview Questions Answers http://www.interviewboat.com/Company/GetCompany
Sponsored Ads

23 comments:

  1. Thanks. Good collection :)

    ReplyDelete
  2. Richard,

    Its tricky really!!!

    ReplyDelete
  3. Hi Vikas,

    This is very helpful.

    Please send me PDF at ashwinikulkarni9@gmail.com

    ReplyDelete
  4. Really good collection of Query help alot.

    ReplyDelete
  5. this is so evil!

    ReplyDelete
  6. Please send me a naked pic of you at ashwinikulkarni9@gmail.com

    ReplyDelete
  7. Really great work bor...Keep it up!!!

    ReplyDelete
  8. Many queries are throwing error in SQL DEVELOPER

    ReplyDelete
    Replies
    1. there query is for MS SQL Server

      Delete
  9. Thanks man...really helpful....

    ReplyDelete
  10. really appreciating...

    ReplyDelete
  11. Thanks for your list! In case you're interested, here's a few more questions I found which you can add to yours:

    http://cc.davelozinski.com/general/tricky-csharp-and-sql-interview-questions

    _

    ReplyDelete
  12. Ah, would have been very much useful if you would have bolded/highlighted what the correct answer is there itself. Found very hard to match with the answers by scrolling till the end of the page everytime...

    ReplyDelete
  13. Hi viKas can you send me the sql server interviews questions and answers for interview preparation EMAIL ID:jeyaraj.soft02@gmail.com

    ReplyDelete
  14. Thanks a lot for your effort dear

    ReplyDelete
  15. Can u plz send some interview question and answers to this email id :udhaya.mail@gmail.com

    ReplyDelete
  16. As I am moving set by set, my interest is getting increased. Really Very Nice Collections. Appreciated..

    ReplyDelete