Define sub-query

Define sub-query.

- Sub-query is a query within a query.
- It is used to return data that will be used in the main query as a condition.
- These subqueries can be used with the SELECT, INSERT, UPDATE and DELETE statements.
- While writing the subquery it must be enclosed within the parentheses.
- Subquery is usually added in the 'WHERE' clause.

Syntax:
SELECT column_name1, column_name2, ā€¦
FROM table1, table2
WHERE column_name OPERATOR
(SELECT column_name1 FROM table1);

Example:
SELECT eId, ename
FROM employee
WHERE e_Id IN
(SELECT dept_Id FROM department);
sp_grantlogin, sp_denylogin and sp_revokelogin
All these three are the system stored procedure used to manage windows account authentication........
Write SQL query to retrieve all tables of the database
Select name from sysObjects where xtype=ā€™uā€™.......
Define Local temporary table and global temporary table
Local temporary table is created by prefixing name with pound sign like (#table_name).......
Post your comment