Share
,

MySQL: Subqueries


  • This is some kinds of sorting. If want to find out some portion of your information according to a order then follow the examples-
    SELECT name, cost FROM items WHERE cost>(250) ORDER BY cost DESC
    ELECT name, cost FROM items WHERE cost>( SELECT cost, AVG(cost) FROM items ) ORDER BY cost DESC



Notice:
  1. For subqueries input the new query inside the bracket () as shown in the example above. 
  2. Here the statement DESC is descending, it is used to make an order.  



                                         

0 comments:

Post a Comment