SELECT Statement WHERE ColumnName [Comparison Operator] (SELECT Statement / Values)
Results of one Sql query or Sql statement as the input for another Select query, Insert Into query, Insert From query, Update query and Delete query.
You also can use the result of Subquery as a search condition for using in the IN( ) function or EXISTS operator.
Comparison Operator such as =, >, <, >=, <=, LIKE, IN
Below is example for SQL UNION
Company | Sales($) | Website |
Sql Traniner | 2500 | http://www.sqltutorials.blogspot.com |
BeautyCentury | 3000 | http://beautycentury.blogspot.com |
TravelYourself | 2800 | http://travelyourself.blogspot.com |
Sales | Website |
2900 | http://www.sqltutorials.blogspot.com |
3000 | http://beautycentury.blogspot.com |
2800 | http://travelyourself.blogspot.com |
SQL Subquery Statement
SELECT * FROM TABLE1 WHERE sales in (SELECT Sales FROM TABLE2)
Result
BeautyCentury | 3000 | |
TravelYourself | 2800 | http://travelyourself.blogspot.com |
SELECT * FROM TABLE1 WHERE sales LIKE (SELECT Sales FROM TABLE2 WHERE Sales <2900)>
Result
TravelYourself | 2800 | http://travelyourself.blogspot.com |
SELECT * FROM TABLE1where sales > (SELECT Sales FROM TABLE2 WHERE Sales <2900)
Result
BeautyCentury | 3000 | http://beautycentury.blogspot.com |
6 comments:
WoW nice blog buddy!Actually WoW is my favorite appreciation keyword. I also like to play. Wow Gold. I was looking for info regarding that and saw your website. Its nice and very interesting.
Fine post
Excellent definition with examples
wow gold kaufen
Interesting post
c9 moneyexperience is a hard teacher because she gives the test first, the lesson afterwards, c9 gold the consequences of today are determined by the actions of the past. To change your future, alter your decisions today c9 online gold.
The past is gone and static. Nothing we can do will change it.scarlet blade gold, the future is before us and dynamic. Everything we do will affect it rs gold, You laugh at mescarlet blade gold for being different , but I laugh at you for being the same.
Nice post very helpful
dbakings
Post a Comment