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
Click here for be continue
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
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
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
110). SELECT 0/9
--output of this query would be.
A). Throw error(Divide by zero error encountered.)
B). NULL
C). 1
D). 0
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
Thanks. Good collection :)
ReplyDeleteawsome
ReplyDeleteRichard,
ReplyDeleteIts tricky really!!!
Hi Vikas,
ReplyDeleteThis is very helpful.
Please send me PDF at ashwinikulkarni9@gmail.com
Really good collection of Query help alot.
ReplyDeleteVery Good Collection
ReplyDeleteNice collection
ReplyDeletethis is so evil!
ReplyDeletePlease send me a naked pic of you at ashwinikulkarni9@gmail.com
ReplyDeleteReally great work bor...Keep it up!!!
ReplyDeleteMany queries are throwing error in SQL DEVELOPER
ReplyDeletethere query is for MS SQL Server
DeleteThanks man...really helpful....
ReplyDeletereally appreciating...
ReplyDeleteAh, 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...
ReplyDeleteHi viKas can you send me the sql server interviews questions and answers for interview preparation EMAIL ID:jeyaraj.soft02@gmail.com
ReplyDeleteThanks a lot for your effort dear
ReplyDeleteCan u plz send some interview question and answers to this email id :udhaya.mail@gmail.com
ReplyDeleteVery UseFul
ReplyDeleteCan u plz send pdf meterial some interview question and answers to this email id :avrao317@gmail.com
ReplyDeletevery helpful
ReplyDeleteHi Vikas,
ReplyDeleteThis is very helpful.
Please send me PDF and new topics on sarikaryadav6@gmail.com
Could u plz send pdf meterial some interview question and answers to this email id :dineshgpt0@gmail.com
ReplyDeletecould you please provide explanation for the answers
ReplyDeleteThanks!
It will be great if you can provide with explanation for each answer.
ReplyDeleteThanks!
this is very helpful. could u plz send pdf of all sql on swapnalikasar18@gmail.com
ReplyDeleteWhere i can find explanation for the answers?
ReplyDeleteSorry currently there is no explanation, If possible we will provide soon.. keep visiting..
Delete