## 查詢單個數據
~~~
// find 方法查詢結果不存在,返回`null`,否則返回結果數組
Db::table('think_user')->where('id', 1)->find();
~~~
~~~
// 如果希望查詢數據不存在的時候返回空數組,可以使用
Db::table('think_user')->where('id', 1)->findOrEmpty();
~~~
~~~
//如果希望在沒有找到數據后拋出異常可以使用
Db::table('think_user')->where('id', 1)->findOrFail();
~~~
## 查詢數據集
~~~
Db::table('think_user')->where('status', 1)->select()
~~~
~~~
//如果希望在沒有查找到數據后拋出異常可以使用
Db::table('think_user')->where('status',1)->selectOrFail();
~~~
~~~
//select方法查詢結果是一個數據集對象,如果需要轉換為數組可以使用
Db::table('think_user')->where('status', 1)->select()->toArray();
//如果沒有查找到數據,同樣也會拋出一個`think\db\exception\DataNotFoundException`異常。
~~~
## 值和列查詢
~~~
// 返回某個字段的值
Db::table('think_user')->where('id', 1)->value('name');
~~~
~~~
// 返回某一列數組
Db::table('think_user')->where('status',1)->column('name');
// 指定id字段的值作為索引,返回某一列的值
Db::table('think_user')->where('status',1)->column('name', 'id');
~~~
~~~
//如果要返回完整數據,并且添加一個索引值的話,可以使用
Db::table('think_user')->where('status',1)->column('*','id');
//指定id字段的值作為索引 返回所有數據
~~~
`column`方法查詢結果不存在,返回空數組
## 數據分批處理
大數據處理需要時,去翻看手冊
## 游標查詢