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 / anil panwar
Hi Shivaraj
the ans you have given that is correct but
anyway,
if different employee id have same age and different region
and region is null in that case will not show Null region
for that employee
it may be solution....
select t1.id, t2.region from t1 left outer Join t2
on t1.id=t2.id
where t1.id in (select id from t1 where age=(select max(age)
from t1)) group by t1.id, t2.region
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain sql delete command?
How can you list all the table constraints in a database?
What protocol does sql server use?
Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?
How to create a new schema in a database?
Explain about Normalization?
What is check constraint in sql server?
List out different types of normalizations in sql server and explain each of them?
What is cte (common table expression)?
What happens when the SQL Azure database reaches Max Size?
What are the differences between stored procedure and the dynamic sql?
What are “unrepeatable reads”?
What are scalar functions in sql?
How does a profiler work?
A user is a member of the public role and the sales role. The public role has select permission on all the tables. The sales role does not have select permission on some of the tables will the user be able to select from all tables?