What are the guidelines for using SUB-QUERIES?

What are the guidelines for using SUB-QUERIES?

Following things need to be kept in mind when you write sub-queries:

- Caution should be taken with simple sub-query, especially when a normal value operator is used on the results of a sub-query, only one field must be returned.

- If you want to check for the existence of a single value within a set of other values, use the IN keyword as an operator upon the result set from a sub-query.

Example of a Sub-Query:
SELECT name FROM students
    WHERE stud_id = (SELECT stud_id FROM class
        WHERE last_name='abc'
            AND first_name='xyz');
What is correlated sub-query?
In a simple SubQuery, the result retrieved by the inner query is fed to the outer query. The outer query takes the result as its input and processes it to produce its output....
Explain drop and truncate table command
TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired.....
Write the command to view the structure of the table
The desc table_name command is used to view the structure of the table....
Post your comment