MySQL where clause that should not work but returns all table contents -


this query returning table contents. me not valid clause. have idea why works?

select * tablename 1 

in mysql, true costant value = 1, while false = 0, query eqivalent to:

select * tablename true 

also, conditions converted either 0 or 1:

select 'a' = 'a' 

will return 1, while

select 'a' = 'b' 

will return 0 example following queries equivalent:

select * tablename true select * tablename 'a' = 'a' select * tablename 1 

but every value <> 0 considered true well, return rows:

select * tablename 2 

but if value <> considered true, 1 expect following query work:

select * tablename 2 = true 

but won't return anything, because 2 = 1. yes, mysql little weird.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -