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
Tell me what do you understand by a view? What does the with check option clause for a view do?
as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration
How we can compare two database data?
What are the different Authentication modes in SQL Server and how can you change authentication mode?
How to replace the Query Result 'Null Value' with a text ?
What new changes are being made in SQL Server?
What is delete query?
What is a non equi join?
Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you
Explain what is scheduled job and how to create it?
Explain what are the restrictions that views have to follow? : SQL Server Architecture
What is compound operators?
How would you choose between a clustered and a non-clustered index?
What is the federation in sql azure?
explain different levels of normalization? : Sql server database administration