MySQL Operators

MySQL Operators

MySQL has different kinds of operator for different kind of purposes.Operators are very helpful they can make querying a database very easy.



  • " = " Operator it is equal to operator
  • WHERE student_name = 'Rahul'

  • " < " Operator it is less than operator
  • WHERE student_id < '2'

  • " > " Operator it is greater than operator
  • WHERE student_id > '5'

  • " <= " Operator it is less than or equal to operator
  • WHERE student_id <= '3'

  • " >= " Operator it is greater than or equal to operator
  • WHERE student_id >= '3'

  • " != " Operator it is Not equal to operator
  • WHERE student_id != '3'

  • " AND " Operator
  • WHERE student_id = '3' AND student_name = 'Rahul'

  • " OR " Operator
  • WHERE student_id = '3' OR student_id = '5'

  • " NOT " Operator
  • WHERE NOT student_id = '3'

  • " IN " Operator it is used to compare and find that the value is in list of expressions.In the bracket we use expressions
  • WHERE student_id IN (1,2,3)

  • " BETWEEN " Operator
  • WHERE student_id BETWEEN '3' AND '5'

  • " LIKE " Operator you can use % and - with LIKE operator
  • /* It displays all the results where student_name is starting 
    from Rah*/
    
    WHERE student_name LIKE 'Rah%'
    
    or 
    
    /* It displays all the results where student_name is ending 
    from hul*/
    
    WHERE student_name LIKE '%hul'
    
    
PrevNext

Subscribe Our Newsletter And Get Tutorials
And Offers Via Email

Subscribe Our Newsletter And Get Tutorials And Offers Via Email