How to select rows with a WHERE clause

The syntax of the WHERE clause with comparison operators

      WHERE expression_1 operator expression_2
      

The comparison operators

       =    Equal 
       >    Greater than
       <    Less than
       <=   Less than or equal to
       >=   Greater than or equal to
       <>   Not equal
      

A WHERE clause that selects products where the product...

Is in the specified category

      WHERE categoryID = 2
      
2nd 2 rows image

Has the specified name

       WHERE productName = 'Gibson Les Paul'
      

Has a list price less than the specified price

      WHERE listPrice < 499.99
      

Has a list price greater than or equal to the specified price

      WHERE listPrice >= 499.99
      

Has a name that starts with the letters A to F

      WHERE productName < 'G'
      

Was added before the specified date

      WHERE dateAdded < '2017-01-31'
      

Was added on or after the specified date

      WHERE dateAdded >= '2017-01-31'
      

Has a discount percent that does not equal the specified amount

        discountPercent <> 30
      

Description

Back