Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update doc of not|! #1054

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## **运算符说明**

`NOT,!` 逻辑运算符用作于*逻辑非*运算。如果操作数为零,则返回结果为 `true`;如果操作数非零,则返回结果为 `false`;若果操作数为 `NOT NUL` 则返回 `NULL`。
`NOT,!` 逻辑运算符用作于*逻辑非*运算。如果操作数为零,则返回结果为 `true`;如果操作数非零,则返回结果为 `false`;如果操作数为 `NOT NUL` 则返回 `NULL`。

## **语法结构**

```
> SELECT not column_name FROM table_name;
> NOT|! value
```

## **示例**
Expand All @@ -20,16 +20,18 @@ mysql> select not 0;
| true |
+-------+
1 row in set (0.02 sec)
mysql> select not null;
+----------+
| not null |
+----------+
| NULL |
+----------+

mysql> select ! null;
+-------+
| !null |
+-------+
| NULL |
+-------+
1 row in set (0.00 sec)
mysql> select not 1;

mysql> select ! 1;
+-------+
| not 1 |
| !1 |
+-------+
| false |
+-------+
Expand All @@ -39,6 +41,17 @@ mysql> select not 1;
```sql
create table t1 (a boolean,b bool);
insert into t1 values (0,1),(true,false),(true,1),(0,false),(NULL,NULL);
mysql> SELECT * FROM T1;
+-------+-------+
| a | b |
+-------+-------+
| false | true |
| true | false |
| true | true |
| false | false |
| NULL | NULL |
+-------+-------+
5 rows in set (0.01 sec)

mysql> select not a and not b from t1;
+-----------------+
Expand All @@ -51,8 +64,13 @@ mysql> select not a and not b from t1;
| NULL |
+-----------------+
5 rows in set (0.00 sec)
```

## **限制**

MatrixOne 暂时还不支持 `!` 运算符。
mysql> select * from t1 where !(a=false);
+------+-------+
| a | b |
+------+-------+
| true | false |
| true | true |
+------+-------+
2 rows in set (0.00 sec)
```
Loading