MySQL Type Conversion in Expression Evaluation


  1. REGEXP takes collation into account.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    MySQL provides pattern matching based on the ‘REGEXP’ operator and regular expressions that are similar to those used in Unix programs, namely, grep, sed and vi. REGEXP does not take collation into account.


  1. The expression ‘2 BETWEEN 2 AND 5’ results in ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The ‘BETWEEN ……. AND’ clause is used to return a boolean value, if the given operand value lies between the values specified by the ‘AND’ clause. The range endpoints are inclusive.



  1. ‘abc’ || ‘xyz’, when PIPES_AS_CONCAT is enabled, results in ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    If the SQL mode PIPES_AS_CONCAT has been enabled, the SQL standard ‘||’ operation for string concatenation becomes valid in MySQL. Both operands are concatenated to give ‘abcxyz’.


  1. If the PIPES_AS_CONCAT is disabled, ‘abc’ || ‘xyz’ results in ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    When the SQL mode PIPES_AS_CONCAT is disabled, the SQL standard ‘||’ operation for string concatenation is not valid in MySQL. Both operands are converted to zero. So the result is zero.



  1. The expression 12 DIV 5 evaluates to ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The ‘DIV’ operator in MySQL is used to perform the integer divisions. The operator ‘/’ performs the quotient of the operands. If result exceeds the 64-bit range, unpredicted results are shown.