# Why is it not recommended to use the mixture of quoted as well as unquoted values in MySQL IN() function’s list?

MySQLMySQLi Database

Actually, MySQL has different comparison rules for quoted values such as strings and unquoted values such as numbers. On mixing the quoted and unquoted values in IN() function list may lead to the inconsistent result set. For example, we must not write the query with IN() function like below −

Select Salary from employee where ID IN(1,’a’,2,3,’c’)


Instead of this the better way to write the above query is as follows −

Select Salary from employee where ID IN(‘1’,’a’,’2’,’3’,’c’)

Published on 21-Feb-2018 09:53:33