F
F
FasterTans2021-12-24 08:08:39
PostgreSQL
FasterTans, 2021-12-24 08:08:39

How to make a select from a column with an array of numbers?

Good afternoon.
There is a jsonb column, it contains data in the form [1,2,3,10,55], how to search for matching elements? For example find rows that have matches with another array? So it searches only for strings and only for 1 element, it doesn’t work with integer (What is actually written in the doc - ? Does the string exist as a top-level key within the JSON value?)
SELECT * FROM test WHERE mycolumn ? '1';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akina, 2021-12-24
@FasterTans

https://www.postgresql.org/docs/current/functions-... @> and <@
operators https://dbfiddle.uk/?rdbms=postgres_12&fiddle=2bd6...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question