Home > database > The mysql database where '1-1 in (1) why is true
The mysql database where '1-1 in (1) why is true
Time:10-15
'where's 1-1 in (1) | true 'where's 1-1 in (' 1') | false Where '2-1 in (1) | false
CodePudding user response:
Select '1 1=1 the result is true, because the database varchar transformed into int, transformed into 1-1 1
CodePudding user response:
The following content, if you can understand, you have the answer, 1, IN the content of the back, if it is digital, so will the IN front of the character content (quoted), converted to digital, 2, in character converted to digital, from the left, one by one, transformation, meet the number, just returned directly, If 'ab', a length is a number greater than or equal to 1, b is a non-numeric characters, then 'ab' convert digital results, is a, Can try the following SELECT the CAST (' 5-5 'AS SIGNED),' 5-1 + 0
Summary, MYSQL, even if a character is digital, also want to quotes, Avoid the following problem SELECT the FROM 0 DUAL WHERE '1 a=1