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 / krishna murari chaubey

create table Employee(empId int,age int)
create table Area(empId int,Region varchar(20))

Use Inner Join

select e.empid,e.age,a.region from Employee e inner join
area a on e.empid=a.empid and e.age in
(select max(age) from Employee)

OR


select empid,region from area where empid in
(select empid from Employee where age
in(select max(age) from Employee))

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why I am getting this error when dropping a database in ms sql server?

590


What are the advantages of passing name-value pairs as parameters?

659


Do you know what are the steps to process a single select statement?

533


1. Tell me your daily activities 2. If sql server installation fails at time installation what will do 3. Where does the sql server installation log details are stored 4. After the installation what will you do for memory configuration 5. What is the difference between SQL max maximum memory and AWE memory 6. How will you configure AWE memory 7. How will setup an email alert for the backup job 8. After the SQL installation what are the jobs will you configure 9. What does –g mean in the sql startup parameter 10. What is the difference between Bulked log and Full recovery model 11. What is the difference between mirroring and log shipping 12. What are the steps to be followed before in-place up gradation 13. After installing the patch the sql server does not start and application team tells to rollback the changes .In this scenario what will you do

2060


How to fetch the next row from a cursor with a "fetch" statement?

590






How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication

549


What functions can a view be used to performed?

622


Why are views required in the sql server or in any other database?

535


What is the difference between having clause and where clause in sql server?

573


Explain tablesample?

555


Do you know what is fill factor and pad index?

567


What is the use of =,==,=== operators?

579


What is SQL Azure?

85


What is global temp table?

560


What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?

592