Queries related with Employee schema.

Q1. Find all the name of employees. SELECT name FROM employee; Q2. Find the name, address of employees who works for department number C001. SELECT name, address FROM employee WHERE deptid=’C001’; Q3. Find the EID, start date of the employees who works for project number 201 or project number 301. SELECT eid, startdate FROM join WHERE pcode=201 or pcode=301; Q4. Find the name, EID of employees whose salary is greater than 20,000. SELECT eid, name FROM employee WHERE salary>20000; Q5. Retrieve all information of employees whose salary is greater than 20,000. SELECT * FROM employee WHERE salary>20000; Q6. Show the resulting salaries if every employee is given a 10 present raise. SELECT name, salary*1.1 FROM employee;

Retrieve name and salary of employee whose salary is between 20000 and 28000. project p. within each project.pcode AND e. Q12. SELECT eid.deptid AND name=’Rahul Gupta’.Find the name of the department that employee Rajendra Gupta works for. join j WHERE j. SELECT name.eid=j. SELECT e. SELECT dname FROM employee e. department d WHERE e. address of all employees. department.eid ORDER BY p. address FROM employee. dname FROM employee. Retrieve a list of employees and the projects they are working on.name.deptid=d. . Retrieve all possible combinations of EID and DName is the database. Q10. p. order the result by project’s name.name. e. Q8.name FROM employee e. Retrieve the name. Q9.name. Q11. SELECT DISTINCT salary FROM employee. Find the name of the employees whose address is in ‘Ram’. Retrieve the distinct values of the salary of employee.Q7. order by employee’s name. SELECT name salary FROM employee WHERE salary BETWEEN 20000 AND 28000. Q13. department. SELECT name FROM employee WHERE address LIKE ‘%Ram%’.pcode=p.

department d WHERE e. retrieve the department number and the corresponding number of employees. Find the number of employee’s works for department Management. For each department with more than 8 employees. . COUNT (eid) FROM employee GROUP BY deptid. Q17. Find all employees with null values for Address.deptid=d. Q16. SELECT deptid. COUNT (eid) FROM employee GROUP BY deptid HAVING COUNT (eid)>8. department d WHERE e.count the number of salary values in the database. Q15.deptid=d. SELECT name FROM employee WHERE address IS null.deptid AND dname=’ Management’.Q14. SELECT AVG (salary) FROM employee e. SELECT COUNT (DISTINCT Salary) FROM employee. For each department. SELECT COUNT (eid) FROM employee e. Q19. Find the average salary of all employees in the Animation department.deptid AND dname=’ Animation’. find the number of employee’s works for that department. SELECT deptid. Q18.

SELECT eid. name.Q20. address FROM employee WHERE deptid IN (C001.eid=e. name FROM employee WHERE salary>=ALL(SELECT salary FROM employee). Q22. Q24. Retrieve the identification number. . Retrieve the name of each employee who has a department with the same name as the employee. Q23. SELECT name FROM employee WHERE salary>ANY(SELECT salary FROM employee WHERE deptid=’L345’).dname). SELECT eid FROM join WHERE pcode IN (SELECT pcode FROM join WHERE eid=’601’). R101). Retrieve the identification number and the name of employees who have the highest salary in the company. S123. SELECT name FROM employee e WHERE EXISTS (SELECT * FROM department d WHERE d. SELECT eid.eid AND name=d. Retrieve the identification number of employees who work in the same project that employee ‘601’ works in. R101. Q21. Retrieve the name of employees whose salary is greater than at least one employee of the department number L345. S123. name and address of employees who work for department number C001.

Sign up to vote on this title
UsefulNot useful