> For the complete documentation index, see [llms.txt](https://doc.tanmer.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.tanmer.cn/shu-ju-ku/postgresql/select-jsonb.md).

# 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>
