The foreach tag is the same as our Java is to traverse iterations, usually after the in keyword
select * from tableName where id in (1,2)
I usually put It serves as the condition in(1,2)
select * from user
where userRole in
#{roleIds}
Foreach attribute:
collection: Iteration means passing Parameters entered
item: an alias representing the iteration of each element in the collection
index: used to represent the position iterated to during the iteration process
open: Indicates what to start with
separator: Indicates what symbol is used as a separator between each iteration
close: Indicates what has ended