Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • MySQL BETWEEN Operator

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 172
    Comment on it

    BETWEEN operator is used to test an expression within a range. Syntax of BETWEEN operator is as follows:

    expr (NOT) BETWEEN begin_expr AND end_expr
    

    -Here expr, begin_expr and end_expr is an expression which must return values.

    -BETWEEN operator returns 1 if the expr is greater than or equal to begin_expr and return 0 if the expr is less than or equal to end_expr.

    -NOT BETWEEN operator returns 1 if the expr is less than begin_expr and return 0 if the expr is greater than end_expr.

    -BETWEEN operators return NULL if any exression is NULL.

    The BETWEEN operator is typically used in the WHERE clause of SELECT, UPDATE, and DELETE statements.

    Example: We have a table name 'demo' in which 'id' and 'name' are two fields. You want the record from the table whose id is in between 4 and 7. Then you will execute the query with the help of BETWEEN operator as follows:

    Select * from demo where id BETWEEN 4 AND 7.
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: