# Sql Question Paper ![](https://i.imgur.com/1Mdmv90.png) 1. Write a SQL query to fetch the count of employees working in project 'P1'. ```sql select count(*) p1_employees from EmployeeSalary where project="p1"; OUTPUT: +--------------+ | p1_employees | +--------------+ | 2 | +--------------+ ``` 2. Write a SQL query to fetch employee names having salary greater than or equal to 5000 and less than or equal 10000. ```sql SELECT FullName from EmployeeDetails where EmpId IN(select EmpId from EmployeeSalary where salary between 5000 AND 10000); OUTPUT: +----------+ | FullName | +----------+ | JOHN | +----------+ ``` 3. Write a SQL query to fetch project-wise count of employees sorted by project's count in descending order ```sql ``` 4. Write a query to fetch only the first name(string before space) from the FullName column of EmployeeDetails table. ```sql ``` 5. Write a query to fetch employee names and salary records. Return employee details even if the salary record is not present for the employee ```sql ``` 6. Write a SQL query to fetch all the Employees who are also managers from EmployeeDetails table ```sql ``` 7. Write a SQL query to fetch all employee records from EmployeeDetails table who have a salary record in EmployeeSalary table. ```sql ``` 8. Write a SQL query to fetch duplicate records from a table ```sql ``` 9. Write a SQL query to remove duplicates from a table without using temporary table. ```sql ``` 10. Write a SQL query to fetch only odd rows from table. ```sql ``` 11. Write a SQL query to fetch only even rows from table. ```sql ``` 12. Write a SQL query to create a new table with data and structure copied from another table ```sql ``` 13. Write a SQL query to create an empty table with same structure as some other table. ```sql ``` 14. Write a SQL query to fetch common records between two tables ```sql ``` 15. Write a SQL query to fetch records that are present in one table but not in another table ```sql ``` 16. Write a SQL query to find current date-time ```sql ```