SQL Query Interview Questions

Поделиться
HTML-код
  • Опубликовано: 5 янв 2018
  • Video talks about
    SQL Query Interview Questions
    SQL Interview Questions
    SQL Interview Questions and answers
    top sql questions
    SQL real time scenario based interview questions
    Top SQL Interview Questions and answers
    Step by step SQL Training videos
    SQL Tutorial
    More videos at
    / @training2sqlmsbi
    MSBI Opportunities/Jobs and Packages
    Please watch and subscribe for more videos..
    #SQLMSBI
    • MSBI Opportunities and...
    ********************************
    Top Procedure Interview questions in SQL Server?????
    Please watch and subscribe for more videos.....
    • SQL Procedure Intervie...
    sample Code :
    --A. Select highest salary from employee table
    SELECT MAX(SAL) AS 'Max Salary' , MIN(Sal) AS 'Min Salary' FROM EMP
    -- B. Get the employee details who has highest salary
    SELECT * FROM EMP WHERE SAL=(SELECT MAX(SAL) FROM EMP)
    -- C. Get the second highest salary from employee table
    SELECT TOP 1 EMPName,SAL FROM (
    SELECT TOP 2 EMPName,SAL FROM EMP ORDER BY SAL DESC) SUB ORDER BY SAL ASC
    -- D. Get the employees list who has the salary between x and y.
    SELECT * FROM EMP WHERE SAL Between 9000 and 13000
    -- E. Get the highest salary on department wise
    SELECT DeptName,MAX(SAL) AS 'MAX SAL' FROM EMP E JOIN DEPT D ON E.DeptNo=D.DeptNo GROUP BY DeptName
    -- F. Get the highest salary, employee name along with department
    SELECT E.EmpName,SUB.DeptName,SUB.[Max Sal] FROM EMP E JOIN
    (
    SELECT E.DeptNo, DeptName,MAX(SAL) AS 'Max Sal'
    FROM EMP E JOIN DEPT D ON E.DeptNo=D.DeptNo GROUP BY DeptName,E.DeptNo) SUB
    ON E.DeptNo=SUB.DeptNo AND E.Sal=SUB.[Max Sal]
  • НаукаНаука

Комментарии • 22

  • @kemidiramesh7434
    @kemidiramesh7434 6 лет назад +5

    yes i want pivot and unpivot video plz make the video

  • @aaryanbpatel
    @aaryanbpatel 4 года назад +2

    Another way for last question is
    select * from Employees e CROSS APPLY (select Department_Id,Max(Salary) as MaxSallery from Employees group by Department_Id) as d where e.Department_Id = d.Department_Id and e.Salary = d.MaxSallery;

    • @Training2SQLMSBI
      @Training2SQLMSBI  4 года назад

      yes.. might be several ways of achieving ...
      thanks for letting me know..

  • @rajesh-kw4do
    @rajesh-kw4do 5 лет назад

    My question like below.
    To display employee name,years worked for and total salary for these years, assume salary to be constant in store procedure
    Using adventure database.
    Please help me how to solve this.

  • @soumyanayak2898
    @soumyanayak2898 5 лет назад

    I have a table like
    City1 city2
    Delhi Goa
    Mumbai Goa
    Pune Delhi
    Goa Pune
    Goa Delhi
    Delhi Pune.
    In this, I don't want those rows in my output table where city1 to city2 is same as city2 to city1.
    my final o/p will be :
    City1 city2
    Delhi Goa
    Mumbai Goa
    Pune Delhi
    Goa Pune

  • @kemidiramesh7434
    @kemidiramesh7434 6 лет назад +4

    give me a video of pivot and unpivot

    • @Training2SQLMSBI
      @Training2SQLMSBI  6 лет назад +1

      Thanks for watching ..
      Do you need pivot /unpivot in SQL server or SSIS ??

  • @renusaraswat9015
    @renusaraswat9015 6 лет назад

    How split the data and display the output in different different columns.
    For ex- Hina Bhatt is a name in name column we want to show Hina in a different column and Bhatt in different column

  • @k.b.n.deepak1113
    @k.b.n.deepak1113 6 лет назад

    Hi instead of sub query why can't you to use rank,danse_rank

  • @mezomezo8718
    @mezomezo8718 Год назад

    Plz show me another easier way to solve this last question .. I didn't get ur query very confusing

  • @Ranjay_Kumar
    @Ranjay_Kumar 6 лет назад +3

    Very Basic SQL Query Interview Questions....Upload some tough questions...

    • @Training2SQLMSBI
      @Training2SQLMSBI  6 лет назад

      Please check this video for some more questions...
      ruclips.net/video/ZJ_hVb9zh00/видео.html

    • @Ranjay_Kumar
      @Ranjay_Kumar 6 лет назад

      Training2SQL MSBI Thank you but I am looking for some more advanced query interview questions....

  • @aaryanbpatel
    @aaryanbpatel 4 года назад

    Alternative way for last question is
    With maxDeptTable
    AS
    (select Department_Id,Max(Salary) as MaxSallery from Employees group by Department_Id
    )
    Select e.FirstName,e.LastName,e.Salary from Employees e Inner Join maxDeptTable on e.Department_Id = maxDeptTable.Department_Id where maxDeptTable.MaxSallery = e.Salary

  • @kemidiramesh7434
    @kemidiramesh7434 6 лет назад +1

    I Want Sql Server Pivot And Unpivot o

  • @talamramachandrarao1292
    @talamramachandrarao1292 4 года назад

    Please increase the font size it is not visible

  • @ranvijaykumar4736
    @ranvijaykumar4736 4 года назад

    Why do you use sub can you explained mor about it

  • @asmitaadhatrao577
    @asmitaadhatrao577 6 лет назад

    Query is not properly visible