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
What are the dmvs? : sql server database administration
What do you mean by data manipulation language?
Why is there a performance difference between two similar queries where one uses union and the other uses union all?
How check triggers in sql server?
Explain about thread and memory management process of SQL?
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
What is difference between inner join and full join?
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
How to create user defined functions with parameters?
What is a domain constraint give an example?
What is the use of sign function?
What is the maximum size per database for sql server express?
Explain how many normalization forms?
What is a matrix in ssrs?
Explain about merge replications?