9951 explained code solutions for 126 technologies


clickhouseSelect rows with all specified values in array column


SELECT * FROM tbl3 WHERE hasAll(list, ['b', 'd'])ctrl + c
tbl3

table with array column in it

hasAll

will return true if specified array column has all specified values in it

list

name of the array column

['b', 'd']

values to search in array column


Usage example

SELECT * FROM tbl3 WHERE hasAll(list, ['b', 'd'])
output
┌──────────────────ts─┬─list──────────┐
│ 2022-01-14 17:41:38 │ ['b','c','d'] │
└─────────────────────┴───────────────┘