Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

Answer / vinoth kumar

select * from department where Dept_id
not in(select Dept_id
from employee)

Is This Answer Correct ?    4 Yes 0 No

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employ..

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

Post New Answer

More SQL Server Interview Questions

What is the purpose of the tempdb database?

0 Answers  


hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary key. example : table1 has 1,2,3,4,5 and table2 has 1,2,3,4,5,6,7,8,9,10 and i want the numbers from 6 to 10 to be displayed and should not come as null. i need the numbers. please reply as soon as possible.

4 Answers  


What is a non-clustered index?

0 Answers  


What's new in sql management studio for sql server? : sql server management studio

0 Answers  


What are defaults? Is there a column to which a default can't be bound?

2 Answers   TCS,


What are the different types of join?

0 Answers  


How can you hide the sql server instances?

0 Answers  


What are the advantages of sql stored procedure?

0 Answers  


How global temporary tables are represented and its scope?

0 Answers  


What is the difference between views and stored procedures? Can we have input parameters for views?

6 Answers  


Can you explain different types of locks in sql server?

0 Answers  


what type of indexes physically sort data?

3 Answers  


Categories