#25 PostgreSQL - JSONB, contains operator to work with JSONB data. JSONB SQL.

Veröffentlicht am: 31 Mai 2023
auf dem Kanal: Software Nuggets
393
5

This video tutorial explaining the use of the contains operator in PostgreSQL to work with JSONB data

The first part of the code sets up a temporary table called temp2 with a single column json_value of type JSONB.

The insert statement adds a JSON value {"a":1,"b":2} into the json_value column of the temp2 table.

The next part of the code simply retrieves all rows from the temp2 table using select * from temp2.

The subsequent lines are comments that explain the purpose of the contains operator in PostgreSQL when working with JSONB data. It checks if the JSONB value on the left side is a subset of the JSONB value on the right side.

The following line select json_value contains '{"a":1}' from temp2 is an example of using the contains operator. It checks if the JSON value {"a":1,"b":2} is a subset of {"a":1}. Since it contains the additional key-value pair "b":2, the result would be false.

The line select '{"a":1}' contains json value from temp2 is another example using the contains operator. It checks if {"a":1} is a subset of the JSON value in the

‪@SoftwareNuggets‬ #softwarenuggets #shorts


Auf dieser Seite können Sie das Online-Video #25 PostgreSQL - JSONB, contains operator to work with JSONB data. JSONB SQL. mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Software Nuggets 31 Mai 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 393 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!