Where and Having Clauses

Discussion in 'Databases' started by Thomasan, Feb 23, 2010.

  1. #1
    Can anyone explain the difference bwtween where clause and having clause.. In many interview ...this question is asked..
    please help me?

    Thanks
     
    Thomasan, Feb 23, 2010 IP
  2. anxggxun

    anxggxun Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    just my short description, the HAVING clause is used for filter the aggregate query, example

    select acolumn, count(1)
    from atable
    group by acolumn
    having count(1) > 2
    Code (markup):
    but the WHERE clause is used for reguler query, example

    select acolumn
    from atable
    where acolumn >0
    Code (markup):
     
    anxggxun, Feb 23, 2010 IP
  3. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110