forum.venkateswarlu.net
      Register      Login
Interview Questions for SQL Server Database developer

7 replies to this topic

Subramaniam R #1
Member
152 Points
Posted on 28 Aug 2013 04:39 PM IST Can anyone post some tricky interview Questions for SQL Server Database developer with answer?  
Interview Questions     973 views     Reply to this topic
Jahnavi N #2
Member
164 Points
Replied on 28 Aug 2013 10:23 PM IST How to find duplicate records from table? Give Select Query.

select city_name, count(city_name) as cnt
from
 areas
group
 by city_name
having
 count(city_name) > 1  
Reply to this topic
Jahnavi N #3
Member
164 Points
Replied on 28 Aug 2013 10:26 PM IST What is the result of following snippet:

declare @val1 varchar(10)
declare @val2 varchar(10)
declare @val3 varchar(10)

set @val3=null
set @val2='adadasd'
set @val1=null

Select COALESCE(@val3, @val1, @val2)

Result: 
adadasd 
Reply to this topic
Jahnavi N #4
Member
164 Points
Replied on 28 Aug 2013 10:27 PM IST What is Index Covering?

Index covering means to add a non-clustered index on every column  which are used in Query. Easy solution to improve query performance

 
Reply to this topic
Jahnavi N #5
Member
164 Points
Replied on 28 Aug 2013 10:29 PM IST What is the difference between RANK & DENSE RANK Functions? Give Syntax.

RANK Functions use 
ORDER BY clause.

SELECT      NAMEOFTHEBANK,

            Branches,

            RANK() OVER(ORDER BY Branches DESC) AS RANKID,

            ROW_NUMBER() OVER(ORDER BY Branches DESC) AS ROWNO,

            DENSE_RANK() OVER(ORDER BY Branches DESC) AS DENSERANK,

            NTILE(3) OVER(ORDER BY Branches DESC) AS NT

FROM tbl_Banks

GROUP BY NAMEOFTHEBANK


RANK() give same ranking for same records and it will skips the duplicate ranks.

example (rank 3 will never assign to any record)

Marks    Rank
98         1
97         2
97         2
96         4

DENSE_RANK() give same ranking for same records and it will continues to the next rank.

example

Marks    Rank
98         1
97         2
97         2
96         3
 
Reply to this topic
Subramaniam R #6
Member
152 Points
Replied on 29 Aug 2013 10:29 AM IST Thanks Jahnavi 
Reply to this topic
Laxman B #7
Member
42 Points
Replied on 22 Sep 2014 01:23 PM IST http://sqlzoo.net/wiki/Main_Page 
Reply to this topic
Laxman B #8
Member
42 Points
Replied on 22 Sep 2014 01:26 PM IST http://sqlzoo.net/wiki/Main_Page 
Reply to this topic