Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how to avoid cursors? : Sql server database administration

976


Can a cursor be updated? If yes, how you can protect which columns are updated?

1114


what is datawarehouse?

1123


What is the difference between functions and scalar functions?

1215


What is simple indexing method?

1039


What are the restrictions while creating batches in sql server?

1065


What are acid properties of transaction?

951


What options are available to audit login activity? : sql server security

1156


How to select some specific columns from a table in a query in ms sql server?

1006


How to create a testing table with test data in ms sql server?

1088


Difference between uniqe index and uniqe constraint?

986


What is the importance of a recovery model?

1052


What are the differences between char and nchar in ms sql server?

1091


what is denormalization? : Sql server database administration

931


Explain what are the database objects? : SQL Server Architecture

1086