please can anyone answer this query

Table 1 has 2 columns: EmployeeId,Age
Table 2 has 2 columns: EmployeeId, Region
Write SQL to Find the region who has the oldest person

Answer Posted / gayathri

create table Emp1(EmployeeId int, Age int);
INSERT into Emp1 Values(1,20);
INSERT into Emp1 Values(2,20);
INSERT into Emp1 Values(3,25);
INSERT into Emp1 Values(4,25);
INSERT into Emp1 Values(5,30);
INSERT into Emp1 Values(6,30);
INSERT into Emp1 Values(7,30);

create table Emp_details(EmployeeId int, Region cahr(10));

INSERT into Emp_details Values(1,'del');
INSERT into Emp_details Values(2,'chn');
INSERT into Emp_details Values(3,'mum');
INSERT into Emp_details Values(4,'del');
INSERT into Emp_details Values(5,'cal');
INSERT into Emp_details Values(6,'mum');
INSERT into Emp_details Values(7,'chn');

select Region from Emp_details ed,Emp1 e1
where e1.EmployeeId = ed.EmployeeId
and e1.Age = (select max(Age) from emp1);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the dmvs? : sql server database administration

600


What do you mean by data manipulation language?

591


Why is there a performance difference between two similar queries where one uses union and the other uses union all?

510


How check triggers in sql server?

524


Explain about thread and memory management process of SQL?

540






let's assume you have data that resides on sql server 6.5. You have to move it sql server 7.0. How are you going to do it? : Sql server database administration

503


What is difference between inner join and full join?

554


but what if you have to create a database with two filegroups, one on drive c and the other on drive d with log on drive e with an initial size of 600 mb and with a growth factor of 15%? : Sql server database administration

532


How to create user defined functions with parameters?

644


What is a domain constraint give an example?

565


What is the use of sign function?

560


What is the maximum size per database for sql server express?

559


Explain how many normalization forms?

581


What is a matrix in ssrs?

101


Explain about merge replications?

594