Query List 46 to 50

1 min read

 Query List

46. List all the employees who joined before or after 1981.

 Query: 

Select * from employee where to_char(hire_date,'YYYY') not in ('1981');

 (OR)

Select * from employee where to_char(hire_date,'YYYY')!='1981'; 

(OR) 

Select * from employee where to_char(hire_date,'YYYY') <> '1981'; 

(OR) 

 Select * from employee where to_char(hire_date,'YYYY') not like '1981';

 Output:

47. List the employees who are working under ‘Manager’. 

 Query: 

Select e.ename || ' works for ' || m.ename from employee e ,employee m where e.manager = m.eno;

 (OR)

 Select e.ename || ' has an employee '|| m.ename from employee e , employee m where e.eno = m.manager; 

 Output:

48. List the emps who joined in any year but not belongs to the month of January.

Query: 

Select * from employee where to_char (hire_date,'MON') not in ('JAN'); 

(OR) 

Select * from employee where to_char (hire_date,'MON') != 'JAN'; 

(OR) 

Select * from employee where to_char(hire_date,'MONTH') not like 'JAN%';

 (OR) 

Select * from employee where to_char(hire_date,’MON’) <> ‘JAN’; 

 Output:  


49. List the emps of Department no 301 or 101 joined in the year 1981.

 Query:

 Select * from employee where to_char(hire_date,'YYYY') = '1981' and (dno =301 or dno =101); 

 (OR) 

Select * from employee where to_char (hire_date,'YYYY') in ('1981') and (dno = 301 or dno =101 ); 

 Output: 



50. List the Eno, Ename, Salary, Dname of all the ‘Manager’ and ‘ANALYST’ working in Paris, Tokyo with an experience more than 7 years without receiving the Commission ascending order of Location. 

Query: 

Select e.eno, e.ename, e.salary, d.dname from employee e, department d where d.location in ('Paris', 'Tokyo') and e.dno = d.dno and e.eno in (select e.eno from employee e where e.job_type in ('Manager','Analyst') and (months_between(sysdate, e.hire_date)/12)> 7 and e.commission is null) order by d.location asc; 

Output:












You may like these posts

  • Query List21. Query to display Name, Department Name and Department No for all the employees. Query: Select EMPLOYEE.Ename, DEPARTMENT.Dname, EMPLOYEE.Dno from EMPLOYEE …
  • Query List41. List the employees who joined on 25-JAN-81, 09-MAY-81, 05-NOV-81, 04- JUN-80 in asc order of seniority.  Query:Select * from employee where hire_date in ('2…
  •  Query List46. List all the employees who joined before or after 1981. Query: Select * from employee where to_char(hire_date,'YYYY') not in ('1981'); (OR)Select…
  • Query List31. Query to display the Department Name, Location Name, No. of Employees and the average salary for all employees in that department.  Query 1: Select Dn…
  • Query List36. Query to display the department no, name and job for all employees in the Sales department.  Query: Select e.Dno, e.Ename, e.Job_type from EMPLOYEE e,…
  • Query List26. Query to display Name, Dept No. and Salary of any employee whose department No. and Salary match both the department no. and the salary of any employee who earns a …

Post a Comment

© 2025DBMS. The Best Codder All rights reserved. Distributed by