SQL Queries
--1. Write an SQL query to fetch all the Employees who are also managers from the EmployeeDetails table. --select * from EmployeeDetails e inner join EmployeeDetails m on e.EmpId = m.ManagerId --2. Write an SQL query to fetch duplicate records from EmployeeDetails (without considering the primary key – EmpId). --select *, ROW_NUMBER() over (partition by [FullName], [DateOfJoining], [City] order by FullName) as rownum from EmployeeDetails --select [FullName], [DateOfJoining], [City],count(*) from EmployeeDetails group by [FullName], [DateOfJoining], [City] HAVING COUNT(*) > 1; --3. Write an SQL query to remove duplicates from a table without using a temporary table. --WITH cteRowNum AS --(select *, ROW_NUMBER() over (partition by [FullName], [DateOfJoining], [City] order by FullName) as rownum from EmployeeDetails) --delete from cteRowNum where rownum >1 --4. Write an SQL query to fetch only odd rows from the table. --WITH cteRowNum AS --(select *, ROW_NUMBER() ov...