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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the steps you should follow to start sql server in single-user mode?

490


Explain indexing and what are the advantages of it?

531


explain different types of cursors? : Sql server database administration

565


How do I get to sql server configuration manager?

522


Do you have any idea about the tcl commands?

557






What are sub reports and how to create them?

99


What happens when unicode strings concatenate with non-unicode strings?

552


How to use old values to define new values in update statements in ms sql server?

686


Explain system scalar functions?

581


What is temporary stored procedure?

550


What are the advantages of user defined function?

496


What is a rollup clause?

547


Explain the steps to use transact-sql cursor?

530


How we create SQL Server 2005 Reporting Services ? Give me Sample

1573


How to create an multi-statement table-valued function?

532