> For the complete documentation index, see [llms.txt](https://learnsql.gitbook.io/lernmysql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnsql.gitbook.io/lernmysql/welcome-to-the-mysql-tutorial/untitled-2.md).

# SQL ANY and ALL Operators

```
Giả sử ta có bảng sau
mysql> SELECT customerNumber, customerName FROM customers;
+----------------+------------------------------------+
| customerNumber | customerName                       |
+----------------+------------------------------------+
|            487 | Signal Collectibles Ltd.           |
|            489 | Double Decker Gift Stores, Ltd     |
|            495 | Diecast Collectables               |
|            496 | Kelly's Gift Shop                  |
+----------------+------------------------------------+
Câu lệnh sử dụng ANY
mysql> SELECT customerNumber, customerName FROM customers 
WHERE customerNumber = ANY(
    SELECT customerNumber FROM customers 
    WHERE customerName='Diecast Collectables'
);
Chú ý 1: Hiện tại tôi chỉ kiểm chứng được  được trường hợp trong ANY kết quả trả về là một câu lệnh SELCT
Chú ý 2: Trường hợp muốn sử dụng dạng mản thì ta sử dụng như sau :))
mysql> SELECT customerNumber, customerName FROM customers WHERE customerName IN ('Diecast Collectables');
Kết quả:
+----------------+----------------------+
| customerNumber | customerName         |
+----------------+----------------------+
|            495 | Diecast Collectables |
+----------------+----------------------+
```
