#13 PostgreSQL – JSON – How to perform simple SELECT statements. #shorts



#13 PostgreSQL – JSON – How to perform simple SELECT statements. #shorts

#13 PostgreSQL - JSON - How to perform simple SELECT statements. #shorts

How to perform SQL Select command on JSON datatype.

The single right angle bracket (->) is used to extract a JSON object field from a json data type in PostgreSQL.

In the given SQL query, contact_info->’phone’ is used to extract the value of the “phone” key from the “contact_info” JSON object in the “people” table. This is done by the -> operator, which returns the value of the specified key as a JSON object.

Learn how to use double right angle bracket (>>) is used as the “cast” operator in the JSON data type in PostgreSQL.

In the given SQL query, contact_info->>’dob’ is used to extract the value of the “dob” key from the “contact_info” JSON object in the “people” table, and it casts the result to a text data type. This is done by the ->> operator, which returns the value of the specified key as text.

@SoftwareNuggets #softwarenuggets #softwareNuggetsShorts, #postgresql, #postgresqlShorts