Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Implement subquery for a database

Hi,
Does anyone knows to implement different subquery and subqueries in a MySQL database. I am trying to implement the same by the default syntax but the query is not generating any result. I need basic information along with the implementation of the same on the database. What is the proper syntax used for the same. What is bifurcation of the syntax. Thanks in advance.
Reply With Quote
  #2  
Old 06-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Implement subquery for a database

A subquery is a type SELECT statement which lies inside a SELECT, SELECT ... INTO, INSERT ... INTO, DELETE, or UPDATE statement or inside any other types of subquery. These three forms of syntax can be used to create a subquery: comparison [ANY | ALL | SOME] (SQL statement) expression [NOT] IN (SQL statement) [NOT] EXISTS (SQL statement). The Where is normally used for comparison. It a type of expression and a comparison operator that normally compares the expression with the result of the subquery. And on the same hand expression is a type of expression that seeks the resulting set of the subquery. And SQL is a usually a SELECT statement, which uses the same format and rules as any other SELECT statement uses. Must be enclosed in parentheses.
Reply With Quote
  #3  
Old 06-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Implement subquery for a database

The subquery can be used instead of an expression in the field list of a SELECT statement or a WHERE or HAVING clause. In a subquery, you use a SELECT statement to provide a set of one or more specified values to assess the expression of the WHERE or HAVING clause. You can use the ANY or SOME predicate, which are synonymous, to retrieve records from the main query that satisfy the comparison with any records retrieved in the subquery.
Reply With Quote
  #4  
Old 06-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Implement subquery for a database

The ALL predicate is used to get only that type of records which lies in the main query that is used to satisfy the comparison with all other records retrieved in the subquery. If you change ANY to ALLin any query then the query returns only that result in reverse to the old table. This is quiet restrictive here. The predicate is used to get those records form the actual or main query for which some records in the subquery have a similar or equal value.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Implement subquery for a database"
Thread Thread Starter Forum Replies Last Post
Implement Simple Database using BST in Java maxmidg412 Software Development 2 31-07-2011 03:22 AM
Creating Database link in database Lachlann Software Development 3 28-01-2010 01:17 PM
How to implement IP Sec Enriquee Technology & Internet 5 12-01-2010 06:28 AM
problem with subquery in MySQL nonose Software Development 3 22-06-2009 01:08 PM
convert filemaker pro database to access database Czack MS Office Support 3 15-04-2007 01:06 AM


All times are GMT +5.5. The time now is 05:37 AM.