SQL Interview Questions part 4

You can see Part 3 here.

46) Display the various jobs and total salary for each job.

47) Display the various jobs and total salary for each job.

48) Display the depart numbers with more than three employees in each dept.

49) Display the various jobs along with total salary for each of the jobs Where total salary is greater than 40000.

50) Display the various jobs along with total number of employees in each job. The output should contain only those jobs with more than three employees.

51) Display the name of the employee who earns highest salary.

52) Display the employee number and name for employee working as clerk and earning highest salary among clerks.

53) Display the names of salesman who earns a salary more than the highest salary of any clerk.

54) Display the names of clerks who earn a salary more than the lowest salary of any salesman.

 55) Display the names of employees who earn a salary more than that of Jones or that of salary grether than   that of scott.

 

56) Display the names of the employees who earn highest salaries in their respective job groups.

57) Display the employee names who are working in accounting department.

 58) Display the employee names who are working in Chicago.

59) Display the Job groups having total salary greater than the maximum salary for managers.

60) Display the names of employees from department number 10 with salary grether than that of any employee working in other department.


 

Questions/Suggestions
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...

2 Responses

  1. Sain Bainuu,

    Muchas Gracias Mi Amigo! You make learning so effortless. Anyone can follow you and I would not mind following you to the moon coz I know you are like my north star.

    This is the first time that I have tried a PIVOT…
    I followed the syntax from
    https://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx exactly as shown in the examples… The problem is that the field ACCOUNTNUM shows as an ERROR… I have tried using an ALIAS for the field but still it returns as an ERROR…
    What am I missing

    SELECT ACCOUNTNUM, [0] AS DEBIT_TRANS, [1] AS CREDIT_TRANS
    FROM
    (
    SELECT ACCOUNTNUM, CREDITING, AMOUNTMST
    from [dbo].[LEDGERTRANS]
    where ACCOUNTNUM between ‘400000’ and ‘999999’
    and transdate between cast(‘2015-02-22’ as date)
    and cast(‘2015-03-28′ as date)
    and POSTING != ’19’
    ) L
    PIVOT
    (
    SUM(AMOUNTMST)
    FOR ACCOUNTNUM IN
    ( [0], [1] )
    ) AS pvt
    ORDER BY pvt.ACCOUNTNUM;

    By the way do you have any YouTube videos, would love to watch it. I would like to connect you on LinkedIn, great to have experts like you in my connection (In case, if you don’t have any issues).
    Please keep providing such valuable information.

    Grazie,
    Ajeeth Kapoor

  2. Thanks for appreciation !
    Could you please elaborate the requirement like what exactly you are trying to achieve? If you can provide the error statement, it would be helpful in understanding the problem more.