close[x]


MySQL

MySQL-Home MySQL-Environment setup MySQL- Workbench MySQL-Basic syntax MySQL-Operator MySQL-Data type MySQL-Comments MySQL-Create DB MySQL-Drop DB MySQL-Select DB MySQL-Create Table MySQL-Drop table MySQL-Truncate MySQL-Primary Key MySQL-Foreign Key MySQL-Null MySQL-Increment MySQL-Having MySQL-Top MySQL-Insert Statement MySQL-Select Statement MySQL-Alter Statement MySQL-Where MySQL-And & Or MySQL-Default values MySQL-Exists MySQL-Order by MySQL-View MySQL-Update Statement MySQL-Delete Statement MySQL-Like MySQL-Sort MySQL-Limit MySQL-Min MySQL-Max MySQL-Group MySQL-In MySQL-Between MySQL-Union MySQL-Count MySQL-Average MySQL-Sum MySQL-Date & Time MySQL-Import MySQL-Export MySQL-Index MySQL-Temporary MySQL-Join MySQL-Full Join MySQL-Inner Join MySQL-Left Join MySQL-Right Join MySQL-Store Procedure MySQL-Injection MySQL-PHP connection



learncodehere.com




MySQL - Operators

Operators are used to perform operations on variables and values.

MySQL statements generally contain some reserved words or characters that are used to perform operations

MySQL Operators are used to specify conditions in an MySQL statement and to serve as conjunctions for multiple conditions in a statement

there are three types of operators in MySQL:

  • MySQL Arithmetic Operators
  • MySQL Comparison Operators
  • MySQL Logical Operators
  • MySQL Arithmetic Operators

    Assume 'variable a' value is 30 and 'variable b' value is 60, then

    Operators Descriptions Examples
    + Adds values a+b will give 90
    - Subtracts right hand from left hand . a-b will give -30
    * Multiplies values a*b will give 1800
    / Divides left hand by right hand . b/a will give 2
    % Divides left hand by right hand and returns remainder. b%a will give 0

    MySQL Comparison Operators

    Assume 'variable a' value is 30 and 'variable b' value is 60, then

    Operator Description Example
    = Checks if the both operands value that are equal or not,if yes condition become true. (a=b) is not true
    != This is used to check the value of both operands equal or not,if not condition become true. (a!=b) is true
    <> Checks if the operand's value equal or not, if values are not equal condition is true (a <>b) is true
    > Checks if the the left operand value is greater than right Operand, if yes condition becomes true (a>b) is not true
    < Checks if the left operand value is less than right Operand, if yes condition becomes true (a
    >= Checks if the value of left operand is greater than or equal to the value of right operand or not,if yes condition become true (a>=b) is not true
    <=Checks if the value of left operand is less than or equal to the value of right operand or not, if yes condition becomes true (a <=b) is true
    ! < Checks if the left operand value is not less than the right operand value (a!
    !> Checks if the value of left operand is not greater than the value of right operand (a!>b) is true


    MySQL Logical Operators

    Here is a list of all the logical operators available in MySQL.

    Operator Description
    ALL ALL operator is used to compare a value to all values in another value set.
    AND AND operator allows the existence of multiple conditions in an MySQL statement.
    ANY ANY operator is used to compare the value in list according to the condition.
    BETWEEN BETWEEN operator is used to search for values, that are within a set of values
    IN IN operator is used to compare a value to that specified list value
    NOT NOT operator reverse the meaning of any logical operator
    OR OR operator is used to combine multiple conditions in MySQL statements
    EXISTS EXISTS operator is used to search for the presence of a row in a specified table
    LIKE LIKE operator is used to compare a value to similar values using wildcard operator