Sunday, 13 July 2014

SQL SERVER QUERY INTERVIEW QUESTIONS - ANSWERS WITH EXAMPLE FOR FRESHER : SET-1 SOLUTION

SQL SERVER INTERVIEW QUERY SET : 1 WITH ANSWERS/SOLUTION

Here I come with more than 100 SQL Server queries for Database/.NET/SQL Server developers, Soon you will get more than 100 SQL query set in pdf/ebook format. So keep visiting this page.
This is for both fresher and experienced developers which would be helpful for Interview preparation.
First try to answer these queries and put comment. After that see the answers of each query in solution set.
Download as PDF

Tables:-




SQL SERVER INTERVIEW QUERY FOR FRESHER SET : 1 SOLUTION
1. Write a query to get all employee detail from "EmployeeDetail" table 
ANS:
SELECT * FROM [EmployeeDetail]


2. Write a query to get only "FirstName" column from "EmployeeDetail" table 
ANS:
 SELECT FirstName FROM [EmployeeDetail]



3. Write a query to get FirstName in upper case as "First Name". 
ANS:
 SELECT UPPER(FirstName) AS [First Name]  FROM [EmployeeDetail]


4. Write a query to get FirstName in lower case as "First Name". 
ANS:
 SELECT LOWER(FirstName) AS [First Name]  FROM [EmployeeDetail]



5. Write a query for combine FirstName and LastName and display it as "Name" (also include white space between first name & last name) 
ANS:
 SELECT FirstName +' '+ LastName AS [Name]  FROM [EmployeeDetail]


6. Select employee detail whose name is "Vikas" 
ANS:
 SELECT * FROM [EmployeeDetail] WHERE FirstName = 'Vikas'



7. Get all employee detail from EmployeeDetail table whose "FirstName" start with latter 'a'. 
ANS:
 SELECT * FROM [EmployeeDetail] WHERE FirstName like 'a%'




8. Get all employee details from EmployeeDetail table whose "FirstName" contains 'k' 
ANS:
 SELECT * FROM [EmployeeDetail] WHERE FirstName like '%k%'


9. Get all employee details from EmployeeDetail table whose "FirstName" end with 'h' 
ANS:
 SELECT * FROM [EmployeeDetail] WHERE FirstName like '%h'



10. Get all employee detail from EmployeeDetail table whose "FirstName" start with any single character between 'a-p' 
ANS:
 SELECT * FROM [EmployeeDetail] WHERE FirstName like '[a-p]%'


Click on the following link for NEXT SET OF QUESTIONS:
CLICK HERE FOR NEST SET (MORE THAN 100 QUERIES)
Visit Our New Site for HR Interview Questions Answers http://www.interviewboat.com/Company/GetCompany
Sponsored Ads

19 comments:

  1. very useful for me

    ReplyDelete
  2. Will all above queries work for normal D.Bases too? I saw these are server query interviews.

    ReplyDelete
  3. Great Article it will help for Freshers as well as experienced professionals

    ReplyDelete
  4. Great Article it will help for Freshers as well as experienced professionals

    ReplyDelete
  5. Thanks all of above commenters for your kind comments

    ReplyDelete
  6. Thanks all of above commenters for your kind comments

    ReplyDelete
  7. Thanks a lot Vikas for preparing this Q&A series, really very much helpful.

    ReplyDelete
  8. Shouldn't you use lower(Firstname) like 'a%' in question 7?

    ReplyDelete
    Replies
    1. No, bcoz it does not matter as sql query is not case sensitive.

      Delete
  9. Dear Vikas really its very useful details shared by this blog .May you send me pdf of "SQL INTERVIEW QUESTION ANSWER" at vipinkamboj13@gmail.com

    ReplyDelete
  10. dear anyone can provide a pdf of that type query on deepak.technologist@gmail.com

    ReplyDelete
  11. try interview questions on http://www.winmilestone.com/Topic?Interview

    ReplyDelete
  12. sanketbeloshe2@gmail.com please give me pdf sir 1 to 6 sql basic questions answers

    ReplyDelete