# 2.4. WHERE

Mệnh đề **WHERE** chỉ định bất kỳ bộ lọc nào để áp dụng cho dữ liệu. Điều này cho phép người sử dụng lọc những thông tin cần thiết. Về mặt logic, mệnh đề **WHERE** được áp dụng ngay sau mệnh đề **FROM**.

**<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:**

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

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

**<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>Ví dụ:**

Chọn tất cả các hàng có id bằng 3:

```mysql
SELECT *
FROM table_name
WHERE id = 3;

```

Chọn tất cả các hàng khớp với biểu thức "**Like**":

```mysql
SELECT *
FROM table_name
WHERE name LIKE '%mark%';

```

Chọn tất cả các hàng có id bằng 3 hoặc bằng 7:

```mysql
SELECT *
FROM table_name
WHERE id = 3 OR id = 7;

```