查詢表達式支持大部分的SQL查詢語法,查詢表達式的使用格式:
```php
where('字段名','查詢條件','表達式');
//如果為 = 則不用寫 表達式
```
表達式不分大小寫,支持的查詢表達式有下面幾種:
| 表達式 | 含義 |
| ------ | -------- |
| = | 等于 |
| <> | 不等于 |
| > | 大于 |
| >= | 大于等于 |
| < | 小于 |
| <= | 小于等于 |
#### 等于(=)
```php
Db::table('user')->where('id',1)->find();
//和下面的查詢等效
Db::table('user')->where('id',1,'=')->find();
```
#### 不等于(<>)
```php
Db::table('user')->where('id',1,'<>')->all();
```
#### 大于(>)
```php
Db::table('user')->where('id',1,'>')->all();
```
#### 大于等于(>=)
```php
Db::table('user')->where('id',1,'>=')->all();
```
#### 小于(<)
```php
Db::table('user')->where('id',10,'<')->all();
```
#### 小于等于(<=)
```php
Db::table('user')->where('id',10,'<=')->all();
```
#### 其他支持
當然除了以上幾個基本條件外,SQL的查詢條件也會有各種復雜條件的條件,這種情況框架也會支持原生方法,你可以直接在where方法內寫入
```php
Db::table('user')->where(" `name` LIKE '%oreo' OR `name` LIKE 'php%' ")->all();
```
以上語句生成
```mysql
select * from oreo_test where `name` LIKE '%oreo' OR `name` LIKE 'php%'
```