Empty IN clause parameter list in MySQL

后端 未结 9 1027
攒了一身酷
攒了一身酷 2020-11-30 08:45

What happens when you do a SQL query where the IN clause is empty?

For example:

SELECT user WHERE id IN ();

Will MySQL

9条回答
  •  一向
    一向 (楼主)
    2020-11-30 08:53

    If you are using that query in an application and you pass dynamically a list of objects to the query, I should not call to the database to do a select with an impossible value, I should return an empty list without calling to the database query, directly.

    Because it has no sense to do a query that you know that is empty before calling it.

提交回复
热议问题