Monday, 14 July 2014

SQL SERVER INTERVIEW QUERY WITH EXAMPLE 4 FRESHER AND EXP : SET-2 WITH SOLUTION

Hey this is Set 2 of SQL Query series, This set is for 0-2 years experienced developers, if you have more than 2 years exp. then don't think that this set not for you here you can remind may things, if you think that you can answer every query here then try and leave comment honestly and after that check your answer in Solution set. This is question set only.
To see the solution follow the link which exist in the end of this post. If you want Sql server query interview question pdf then wait for some days, we will soon come with pdf. which will contain more then 100 sql server query with solution.

So lets try this set.

SQL SERVER QUERY INTERVIEW QUESTION SET : 2

Related Tables:-


Questions Answers

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


12). Get all employee detail from EmployeeDetail table whose "Gender" end with 'le' and contain 4 letters. The Underscore(_) Wildcard Character represents any single character.
Ans: SELECT * FROM [EmployeeDetail] WHERE Gender like '__le' --there are two "_"


13). Get all employee detail from EmployeeDetail table whose "FirstName" start with 'A' and contain 5 letters.
Ans: SELECT * FROM [EmployeeDetail] WHERE FirstName like 'A____' --there are four "_"


14). Get all employee detail from EmployeeDetail table whose "FirstName" containing '%'. ex:-"Vik%as".
Ans: SELECT * FROM [EmployeeDetail] WHERE FirstName like '%[%]%'
--According to our table it would return 0 rows, because no name containg '%'

15). Get all unique "Department" from EmployeeDetail table.
Ans: SELECT DISTINCT(Department) FROM [EmployeeDetail]


16). Get the highest "Salary" from EmployeeDetail table.
Ans: SELECT MAX(Salary) FROM [EmployeeDetail]


17). Get the lowest "Salary" from EmployeeDetail table.
Ans: SELECT MIN(Salary) FROM [EmployeeDetail]


***SQL SERVER DATE RELATED INTERVIEW QUERY***

18). Show "JoiningDate" in "dd mmm yyyy" format, ex- "15 Feb 2013"
Ans: SELECT CONVERT(VARCHAR(20),JoiningDate,106) FROM [EmployeeDetail]


19). Show "JoiningDate" in "yyyy/mm/dd" format, ex- "2013/02/15"
Ans: SELECT CONVERT(VARCHAR(20),JoiningDate,111) FROM [EmployeeDetail]


20). Show only time part of the "JoiningDate".
Ans: SELECT CONVERT(VARCHAR(20),JoiningDate,108) FROM [EmployeeDetail]


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

24 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Explain 108,106,111

    ReplyDelete
  3. 13 and 14 were copypasted from 12 and comments were not corrected per example.
    As a result both contain phrase « --there are two "_" »
    In reality 13 should state « -- there are four "_" » and 14 should have nothing - there are no underscores there.

    ReplyDelete
  4. For Date Refer this , http://www.w3schools.com/sql/func_convert.asp

    ReplyDelete
  5. Se.sachin92@Gmail.com
    very nice questions

    ReplyDelete
  6. I want some SQL queries ralted to fresher and experience interview question.
    This is m mail I'd: santoshpulakala@gmail.com.
    Plz send me sir...

    ReplyDelete
  7. hi,


    Pls send me the pdf.emailparthi@gmail.com

    ReplyDelete
  8. hii.... plz send me d pdf for sql
    mail id- rahejaanubhav03@gmail.com

    ReplyDelete
  9. hii.... plz send me d pdf for sql
    mail id-ramya.karini59@gmail.com

    ReplyDelete
  10. Can u please mail me the pdf for sql questions
    sejal_hemal@yahoo. Com
    Thanks

    ReplyDelete
  11. Can you give me answer of Question number 11 in plsql Please

    ReplyDelete
  12. can you please mail pdf over my mailid "atcsupport@skyproductivity.com"

    ReplyDelete
  13. Can you please email me pdf for 2-3 yrs experienced on sahil82@gmail.com

    ReplyDelete
  14. Can you please email me pdf for 2-3 yrs experienced on sahil82@gmail.com

    ReplyDelete
  15. Hi Vikash, I'm a 1.6 year experience guy working on MS SQL SERVER, your post very useful for me up to SET-1 to SET-10 So can u mail me PDF's to myid : jsreddy2286@outlook.com
    jeripothulajsreddy@gmail.com

    ReplyDelete
  16. hi maahi mehta i m fresher can you please send me pdf sql queries and question too. my id is maahi.mehta.08@outlook.com

    ReplyDelete
  17. can you please explain the date format conversion. Are the styles/date format code(106,108 etc.) pre-defined and we have to remember them individually or there is some logic.

    ReplyDelete
  18. it is better if we get the DDL & DML query for the example table.

    ReplyDelete
  19. IN 18TH QUS..IN ANS: WHAT IS '106' REPRESENT.

    ReplyDelete
    Replies
    1. '106' IS THE DATE FORMAT CODE FOR SPECIFIC FORMAT, THERE ARE MANY CODE FOR DIFF-DIFF DATE FORMAT. YOU CAN TRY OTHER ALSO.

      Delete
  20. I want some new query as fresher and experiance.
    this is my mail id like-prasantakmr2@gmail.com


    ReplyDelete
  21. hi,
    Can u please help m out with Poc SQL practice questions

    ReplyDelete