Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Subquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 363
    Comment on it

    A subquery is a query within a query embedded within where clause

    It is used to return the data that will be used in the main query as a condition to the data that is retrieved.

    SELECT, INSERT, UPDATE, and DELETE statements along with the operators like =, <, >, >=, <=, IN, BETWEEN are the clause which can be used for subquery.

     

    Rule of the subquery

    1. A subquery should always be in the parenthesis.

    2. A subquery can have only one column in the SELECT clause

    3. It can not be used with order by

    4. Subqueries that return more than one row can only be used with multiple value operator

    5. SELECT list cannot include any references to values that evaluate to a BLOB, ARRAY, CLOB, or NCLOB.

    6. A subquery cannot be immediately enclosed in a set function

    7. The BETWEEN operator cannot be used with a subquery; however, the BETWEEN operator can be used within the subquery

     

    example:

    SELECT column_name [, column_name ] FROM table1 [, table2 ] WHERE column_name OPERATOR (SELECT column_name [, column_name ] FROM table1 [, table2 ] [WHERE])

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: