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 is a fill factor?
Explain about system stored procedure?
What are alternate keys?
What happens if null values are involved in string operations?
Tell me the phases a transaction has to undergo?
How can I add Reporting Services reports to my application?
Explain few examples of stored procedure over triggers?
why would you call update statistics? : Sql server database administration
Write a query for primary key constraint with identity key word?
How to get a list of columns in a view using the "sp_help" stored procedure?
How to encrypt data between dialogs?
Do you have any idea about the tcl commands?
can we have a nested transaction? : Sql server database administration
What is Federation and Federation Member?
What is format parameter in ssrs?