# select  jsonb

例:

```
table_name  -> company_contents
column_name -> content
column_type -> jsonb
data        ->  {
                  "企业类型": '有限公司'，
                  "经营范围": 'IT',
                  "企业资质": {
                    "主板上市": true
                  }
                }

# 查询 ( 企业类型 = '有限公司' ) 的所有企业

select * from company_contens where ( content ->>  '企业类型' = '有限公司' );

# 查询 ( 主板上市 = true ) 的所有企业

select * from company_contents where ( content -> '企业资质' ->> '主板上市' = ture )
```

上面主要运用了 -> 和 ->> 做查询，->  作用是获取 json 对象，->>  则是获取一个文本信息，详细请查阅官方文档: <https://www.postgresql.org/docs/9.6/static/functions-json.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.tanmer.cn/shu-ju-ku/postgresql/select-jsonb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
