Tutorials Hut

  • SQL Testing




  • What is subquery in SQL?

      • A subquery is a SQL query within a query.
Nested queries that provide data to the enclosing query.
      • Can be used in SELECT, INSERT, UPDATE, and DELETE statements
      • Subqueries can be used to retrieve data from multiple tables and can be used as an alternative to a join
      • Subqueries can also be used inside the WHERE or HAVING clause of the SELECT, INSERT, UPDATE, and DELETE statements
    Syntax
    SELECT Column names  FROM Table1  
    WHERE  ColumnName [Comparison Operator] 
    (SELECT  ColumnName
    FROM Table2  WHERE  [Condition]);

    [Comparison Operator] could be equality operators such as =, >, <, >=, <=. I  or LIKE operator

    Recommended Articles:



  • SQL Testing


















  • Leave a Reply

    Your email address will not be published. Required fields are marked *