what is subquery statement in sql

what is subquery statement in sql

prabakaran328
Views: 515 | Community Opinion: 2



Bookmark this page..



Ask a New Question Go to Home

Community Opinion/Answers
 
Gourav Said..

SQl is an Structured Query language. we use some kind of queries to get results from with or without conditions like

SELECT * FROM Tbl_Students WHERE Stu_Marks >70

so this is an simple type of Sql Query statement. sometime we need to use nested query statement known as sub-query statement LIKE

SELECT * FROM Tbl_Student WHERE Stu_Marks > (SELECT Stu_Marks FROM Tbl_Student WHERE Stu_Id = 126 )

so in this query i want to find out those students having marks more than marks of student id no 126.

so these type of queries are known as subquery statement.

Thanks




bharti gogia Said..

A subquery in sql sever is a SELECT statement within another SQL statement. The SQL statement can be SELECT, WHERE clause, FROM clause, JOIN, INSERT, UPDATE, DELETE, SET, DO, or another subquery.
Below are the two link for the same
http://www.interviewqsn.com/what-is-subquery-and-its-advantage.html
http://www.interviewqsn.com/different-properties-and-types-of-subquery.html






What do you think? Add your opinion/answer
*Name
*your opinion/answer: