I have a description of the user_info table as follows
Field Type null Type Extra usr_id int(11) NO PRI auto_increment f_name varchar(50) NO l_name varchar(50) YES user_name Varchar(45) NO password varchar(128) NO email varchar(50) NO type enum('a','s','c') NO
Data inside the table
0 admin admin admin d033e22ae348aeb5660fc2140aec35850c4da997 admin@oww.com a 1 staff Staffer staff d033e22ae348aeb5660fc2140aec35850c4da997 staff@oww.com s 2 staff2 stafer staff2 d033e22ae348aeb5660fc2140aec35850c4da997 staff2@oww.com s 10 Shanoop Pattanath shan123456 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 shan@shan.com s
SQL query
SELECT * FROM (`user_info`) WHERE `user_name` = 0
Result for this query
0 admin admin admin d033e22ae348aeb5660fc2140aec35850c4da997 admin@oww.com a 1 staff Staffer staff d033e22ae348aeb5660fc2140aec35850c4da997 staff@oww.com s 2 staff2 stafer staff2 d033e22ae348aeb5660fc2140aec35850c4da997 staff2@oww.com s
How does this query match all the data? this query should not yield any result, right? what have i done here? detailed answers are well rated by MySQL ver: 5.5.35-0ubuntu0.13.10.2 (Ubuntu) . SQL FIddle
All username, password and emails are just imaginary
Update I know that 0 must be inside quotation marks. I solved this problem by doing so. But why does MySQL give this wired output.?
source share