8
Reply

What is sub query and its properties?

Suresh Kumar

Suresh Kumar

7y
1.1k
1
Reply

    In simple words , Sub query is a collection of queries like nested queries ( A query with another query embedded with another queries with in the "Where" class.The use of Sub query is used to return the data that is used in the main query then the condition to restrict the data. Properties: The query must contain the two or more sub queries.It must be enclosed with the parenthesis.

    it is a query under query with in " where" condition

    Sub Query - A Query which is inside where clause. It returns data which is used in the main query to execute.Sub query is always executes first. More than one sub query in a single query. It does not contain order by clause

    Query with in query that is called Sub query.sub query also called INNER QUERY.For example see the below query:SELECT p.productid, p.productName FROM products p WHERE p.productid IN(SELECT pd.productidFROM productdetails pdWHERE pd.quantity > 5); it is the inner query in this statement. (SELECT pd.productid FROM productdetails pd WHERE pd.quantity > 5)

    A subquery is also known as a nested query which means query inside another query. A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.Properties of Sub-Query A subquery should be boxed within the parenthesis. A subquery should be placed within the right hand of the comparison operator, and a subquery cannot contain an ORDER BY clause. A query can contain more than one sub-queries.

    Subquery is a nested query, not necessarily defined by a where clause only. Subquery act as a filter condition for the primary query

    A Subquery or Inner query or a Nested query is a query within another SQL query and embedded within the WHERE clause. A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.

    ''