# 3.3. Toán tử IN

**<span style="mso-list: Ignore;">a)<span style="font-style: normal; font-variant: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';"> </span></span>Cú pháp**

![](https://book.inetcloud.vn/uploads/images/gallery/2024-07/embedded-image-1gtwykqw.png)

**<span style="font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes;"> </span>**

**<span style="mso-list: Ignore;">b)<span style="font-style: normal; font-variant: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';"> </span></span>Toán tử**

**IN**

Toán tử **IN** kiểm tra sự chứa đựng của biểu thức bên trái bên trong tập hợp các biểu thức ở phía bên phải (P). Toán tử **IN** trả về true nếu biểu thức có trong P, false nếu biểu thức không có trong P và P không có giá trị NULL hoặc NULL nếu biểu thức không có trong P và P có giá trị NULL.

```mysql
SELECT 'Toán' IN ('Toán', 'Văn');
-- true

```

```mysql
SELECT 'Toán' IN ('Văn', 'Anh');
-- false

```

```mysql
SELECT 'Toán' IN ('Văn', Toán', NULL);
-- true

```

```mysql
SELECT 'Toán' IN ('Văn', 'Anh', NULL);
-- NULL

```

**NOT IN**

**NOT IN** có thể được sử dụng để kiểm tra xem một phần tử có tồn tại trong tập hợp hay không. x **NOT IN** y tương đương với **NOT**(x **IN** y)

##   