-->

SQL Interview Question Set 2

Posted by Admin on
Write a SQL query to print the Name of the managers with id who are having more than 3 employee under him. 

employees(EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,MANAGER_ID,DEP_ID) 

Select First_NAME,LAST_NAME,EMPLOYEE_ID  from employees where EMPLOYEE_ID in ( Select  MANAGER_ID from employees group by MANAGER_ID having count(*)>=3 )  


Write a SQL query to insert rows into a table called "temp(emp_name,age)" where an emloyee must have a salary higher than 2000, where employee table is as 
employee(id,name,age,salary).

insert into temp (select name,age from employee where Salary >2000);


No comments:

Post a Comment