Files
oceanbase/docs/docs-cn/7.developer-guide-1/2.connect-to-the-oceanbase-database/6.query-table-data/3.you-can-call-this-operation-to-query-the-data-that.md
2022-02-10 14:51:49 +08:00

39 lines
1.3 KiB
Markdown

查询表里符合特定搜索条件的数据
====================================
当要查询满足特定搜索条件的数据时,给 SELECT 查询语句增加一个 WHERE 子句即可。SQL 语句格式如下:
```javascript
SELECT select_list FROM table_list
WHERE query_condition
```
以"在 ODC 中运行查询"页面的图为例,查询 2 号仓库第 5 区的订单,SQL 语句如下:
```javascript
SELECT * FROM ordr WHERE o_w_id=2 and o_d_id=5 ;
```
在 ODC 中的查询结果如下图所示:![](https://cdn.nlark.com/yuque/0/2020/png/177325/1600744555056-0404ef68-710f-4829-a877-a82853b7fabd.png)​
执行结果如下:
```unknow
+--------+--------+------+--------+--------------+----------+-------------+------------+
| o_w_id | o_d_id | o_id | o_c_id | o_carrier_id | o_ol_cnt | o_all_local | o_entry_d |
+--------+--------+------+--------+--------------+----------+-------------+------------+
| 2 | 5 | 2100 | 2100 | 5 | 12 | 1 | 2020-02-15 |
| 2 | 5 | 2101 | 4 | NULL | 11 | 1 | 2020-02-15 |
| 2 | 5 | 2102 | 440 | NULL | 7 | 1 | 2020-02-15 |
+--------+--------+------+--------+--------------+----------+-------------+------------+
3 rows in set (0.01 sec)
```