Write a stored procedure for emplpoyee and department table
to get DeptName which having no employee.
Table Structure-
Emp-Emp_Id,Emp_Name,Dept_id
Dept-Dept_Id,Dept_Name
Answers were Sorted based on User's Feedback
Answer / madhuparna bhaumik
/*stored procedure for emplpoyee and department table
to get DeptName which having no employee*/
CREATE PROCEDURE sp_myStoredProcedure
AS
select * from emp full join departments on
emp.department_id=departments.department_id
where employee_id is null;
Go
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / vinoth kumar
select * from department where Dept_id
not in(select Dept_id
from employee)
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / ayush
create proc DeptName
begin
select * from emp full join dept on emp.deptno=dept.deptno
where empno is null;
end
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sivaram pothuru
select * from emp full join dept on emp.deptno=dept.deptno
where empno is null;
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / unnikrishnan nair r
CREATE PROCEDURE GetDept
AS
SELECT Dept_name from dept
WHERE Dept_Id NOT IN(SELECT DISTINCT Dept_id FROM Emp )
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sql pro
/*stored procedure for emplpoyee and department table
to get DeptName which has no employee records*/
select d.dept_name
from dept d
left join empl e
on d.dept_id = e.dept_id
where e.dept_id is null
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sivaram pothuru
select a.*,d.* from dept a
left join emp d on a.deptno=d.deptno where d.deptno is null
Is This Answer Correct ? | 4 Yes | 5 No |
How do you delete duplicate rows in sql server?
how can you move the master database
on line cluster can we make if yes tell me the procedure
What are the two modes of authentication in sql server?
When do we use the UPDATE_STATISTICS command?
4 Answers Deutsche Telekom AG,
What do you mean by recursive stored procedure?
Disadvantages of the indexes?
In which files does sql server actually store data?
How much memory that we are using in Logshipping Concept?
Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security
how to restart sql server in single user mode? How to start sql server in minimal configuration mode? : Sql server database administration
What is split brain scenario in DB mirroring?