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 ...

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)

Related

SQL SERVER 8414734136971673091

Post a comment

  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
  22. Can u please mail me the pdf for sql questions
    Priyaswamy06@gmail.com
    Thanks

    ReplyDelete
  23. in above 18th question we may write query like this

    select extract(hiredate,'dd-mon-yyyy') from emp;


    or

    select to_char(to_date(hiredate),'dd_mon_yyyy') from emp;



    is this write or wrong?

    ReplyDelete
  24. hai sir can you please share me the PDF of sql interview Q & A @shabashi2482@gmial.com
    as a fresher i am searchig for job

    ReplyDelete

emo-but-icon

Follow Us

Recent

Comments

Donate

Side Ads

Text Widget

Connect Us

Sql Server 2017 Interview Questions
Sql Server Basic Interview Query Set-1
Sql Server Basic Interview Query Set-2
Sql Server Date-Time Interview Query SET-3
Sql Server Salary Interview Query SET-4
Sql Server Group By Interview Query SET-5
Sql Server Join Interview Query SET-6
Sql Server Tricky Join Interview Query SET-7
Sql Server DDL Interview Query SET-8
Small but very Tricky Sql Server Query SET-9
Very Much Tricky Query (not 4 fresher)SET-10
Sql Server Complex Interview Query SET-11
Sql Server Datatype Interview Questions
Sql Server View Interview Questions
Sql Server Index Interview Questions
TCS Tricky Sql Interview Queries
HCL Sql Interview Queries
Sql Server SP Interview Questions
Sql Server Trigger Interview Questions
Sql Server Temp Table Interview Questions
Sql Server 2016 Interview Questions
Sql Server Performance Tuning Interview Q.
Sql Server Constraints Interview Questions
Sql Server Storage/Size Interview Questions
Sql Server Very Basic Interview Questions
Sql Server Quiz for Fresher
Sql Server Icon Quiz for All
Sql Server 300+ Theoretical Interview Questions
Sql Server Complete Set

ASP.NET AND JQUERY INTERVIEW QUESTION
ASP.NET: Web Config Interview Question
ASP.NET: View State Interview Question
ASP.NET: Session Interview Question
ASP.NET: Session Interview Question 
ASP.NET: Security Interview Question
ASP.NET: Catching Interview Question
C# OOPS Interview Question
MORE Interview Question
JQUERY: Interview Question Set-1
JQUERY: Interview Question Set-2
JAVA-SCRIPT: Interview Question Set-1
JAVA-SCRIPT: Interview Question Set-2
ASP.NET MVC: Interview Question Set-1

POPULAR POSTS
10 MOST DIFFICULT INTERVIEW QUESTIONS
5 BEST INTERVIEW TIPS
YOUR 10 MISTAKE DURING INTERVIEW
2016 TOP 20 GROUP DISCUSSION TOPICS
HOW SQL PERFORMANCE AFFECTED BY DATATYPE
item