SQL SERVER QUESTIONS Part-3
Q 1. How to delete all employees from a department in one query?
Q 2. How can you find the total number of departments in the company?
Q 3. How to write a query to remove all records from a table but keep the table Structure?
Q 4.How to find the department with the highest number of employees?
Q 5. How to fetch the first and last record from a table?
Q 6. How to write a query to update the salary of all employees by 30%?
Q 7. How to find all employees who do not have any subordinates ?
Q 8.Write a query to fetch employees having the highest salary in each department.
Q 9. How to retrieve the last 15 records from a table?
Q10. How to get the nth highest salary in SQL Server?
Q11. Write a query to fetch employees whose salary is a multiple of 20,000.
Q12. How to find the youngest employees in the organization?
Q13. How to fetch records where a column has null values ?
Q14. Differentiate between Char vs NChar?
Q15. Write a query to fetch all employees whose names end with ‘n’.
Q16. How do you fetch all employees whose salary is greater than the average salary?
Q17. Write a query to find employees whose name starts with ‘A’.
Q18. How to get the nth highest salary in SQL server?
Q19. How to update salaries of employees based on their department?
Q20. What is the difference between UNION and UNION ALL?
Q21. How to display all employees who have been in the company for more than 5 Years?
Q22. How do you fetch the top 8 employees with the highest salaries?
Q23. How to find employees who joined the company in the same month and year as their manager?
Q24. How to find duplicate records in a table?
Q25. Write a query to count the number of employees whose names start and end with the same letter.