ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
Following are some of the question related to below 
mentioned query?

select e1.salary from employee3 e1 
where 2=
(
	select count(distinct(e2.salary)) 
	from employee3 e2 where e2.salary>=e1.salary
)

1) What the query returns?

2) How it works? - Detail explanation (what the sub query 
does, why it is (where 2=)....etc...Please?
 Question Submitted By :: Ashok
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Following are some of the question related to below mentioned query? select e1.salary from employee3 e1 where 2= ( select count(distinct(e2.salary)) from employee3 e2 where e2.salary>=e1.salary ) 1) What the query returns? 2) How it works? - Detail explanation (what the sub query does, why it is (where 2=)....etc...Please?
Answer
# 1
Hi

1.Here query will return 2nd highest salary
2.here 2= i.e 2nd heigest similary if we set N in place 
of   2 then it will returen Nth heigest salary
where n =1,2,3,4.....

Hope it will help u

Ashok
 
Is This Answer Correct ?    2 Yes 0 No
Ashok
 
  Re: Following are some of the question related to below mentioned query? select e1.salary from employee3 e1 where 2= ( select count(distinct(e2.salary)) from employee3 e2 where e2.salary>=e1.salary ) 1) What the query returns? 2) How it works? - Detail explanation (what the sub query does, why it is (where 2=)....etc...Please?
Answer
# 2
Hi

1.Here query will return 2nd highest salary
2.here 2= i.e 2nd heigest similary if we set N in place 
of   2 then it will returen Nth heigest salary
where n =1,2,3,4.....

Hope it will help u

Ashok
 
Is This Answer Correct ?    2 Yes 0 No
Ashok
 
 
 
  Re: Following are some of the question related to below mentioned query? select e1.salary from employee3 e1 where 2= ( select count(distinct(e2.salary)) from employee3 e2 where e2.salary>=e1.salary ) 1) What the query returns? 2) How it works? - Detail explanation (what the sub query does, why it is (where 2=)....etc...Please?
Answer
# 3
First of all this query doesn't execute. I tried it on SQL
2005 and kept getting error.
 
Is This Answer Correct ?    0 Yes 3 No
Chintan
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is Deadlock? Satyam3
What are the advantages of using stored procedures? Please don't simply say compilation time will be saved as they are already complied. Please specify some other advantages. 247Customer3
plz send every query in sql server2000 Infosys1
Table student containing 2 columns,Join date,Employee name. Under join date 4 rows r ter =1-jan-2008,2-feb-2008,3-mar- 2008,4-feb-2008.Under Employee name 4 difeerent names jaison,robin,binoy,rahul Result set is, Table containing 4-column name=jan,feb,mar,april,,beneath these months count is given as 1,2,1,0 means these counts representing number of emplooyees joined in a month(january 1employee,february 2 employee,march 1 employee,april 0 employee) Can you give me the required sql query Wipro3
can you any body tell me while running BCP Out in instance in sql server 2000 is getting error. Error = [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.?  1
Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot?  1
Delete duplicate rows from a table without primary key by using a single query Table Employee empname salary A 200 B 300 A 200 C 400 D 500 D 500 Output should be A 200 B 300 C 400 D 500  2
i want to create procedure for create table in sql server 2005 for example create procedure create_table @table varchar(20) as create @table( id int, name char(20) ) but it will get error what is solution? Aptech4
How to Create Login and User through query in Sql server 2005.and also how to delete Login and User through query?  2
How do you find the error, how can you know the number of rows effected by last SQL statement?  2
I have a website that allows customers to browse and place orders for certain products. I have 2 tables; Customers and Orders. The Customers table holds the customer records and the Orders table holds the orders placed by the customer. Both tables are tied based on the field Cust_ID. Example of the data is shown below: Cust_ID Cust_Name Cust_ID Product Amount Order_Date 1001 John Tan 1001 P-5211 $120.00 2/13/2006 1002 Michael Wong 1001 K-1428 $88.90 1/11/2006 1003 Mary Cheong 1003 C-0923 $82.50 1/27/2006 1004 Ahmad Suffian 1003 K-1428 $88.90 2/2/2006 Write a single SQL statement that extracts all purchase records with the following criteria: 1. Customer names starting with “M” only. 2. Orders placed within the current month only. 3. Amount does not exceed $100.00 The list must be sorted by order date with the latest order showing on top. Techno-Solutions3
how to select 5 to 7 rows from a table, which contains 10 rows? IBM14
plz tell me the new features of sqlserver2000,sqlserver2002,sqlserver2005  3
When do we use the UPDATE_STATISTICS command?  3
How to perfor If the table running time is taking 2hours and table is having 10 rows in it?  1
how to select a field with firstletter as capital and remaining are small letters  8
What are the different types of joins and what does each do?  2
write query for fourth maximum salary from employee table Mind-Tree5
what is the difference between group and having give an example with query and sample output  2
can anybody tell us, how to select 2nd max salary from table. my id is ashish.akk@gmail.com Symphony21
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com