What are sub-queries? Give example? In which case
sub-queries are not feasible?

Answer Posted / amit kumar

A subquery is simply a SELECT query within a SELECT query.

example:-

SELECT City, Salary, (SELECT AVG(Salary) FROM Employee)
AS AvgSalary FROM Employee;

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference statement and preparedstatement?

635


How many clustered indexes can be created on a table? I create a separate index on each column of a table. what are the advantages and disadvantages of this approach?

773


This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?

2108


What is the default port for SQL Server over a firewall?

687


How to create database with physical files specified in ms sql server?

643






What are the properties of primary key?

618


explain the storage models of olap? : Sql server database administration

596


What is factless fact table? : sql server analysis services, ssas

658


What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

648


What is pessimistic concurrency?

625


What is dirty page?

644


How to get a list of columns in a view using the "sp_columns" stored procedure?

703


How to deploy the Report?

97


What are pessimistic lock and optimistic lock?

652


What are the types of subscriptions in SQL Server replication?

629