Bug #117542 INTERSECT is working in MySQL 8.0.40, but it's not in the official documentation!
Submitted: 21 Feb 18:23
Reporter: prashant kumar jaiswal Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:8.0.40 OS:Windows
Assigned to: CPU Architecture:Any
Tags: bug, intersect, MySQL 8.0.40, SQL

[21 Feb 18:23] prashant kumar jaiswal
Description:
### MySQL Version: 8.0.40 (Community Edition)  
**Issue:**  
The INTERSECT operator is working in MySQL 8.0.40, even though MySQL documentation states that INTERSECT is not supported.  

### Steps to Reproduce:  
1. Create two tables with some common data:
   ```sql
   CREATE TABLE A (id INT PRIMARY KEY);
   CREATE TABLE B (id INT PRIMARY KEY);
   INSERT INTO A VALUES (1), (2), (3);
   INSERT INTO B VALUES (3), (4), (5);

How to repeat:
1. Run the following SQL statements:
   CREATE TABLE A (id INT PRIMARY KEY);
   CREATE TABLE B (id INT PRIMARY KEY);
   INSERT INTO A VALUES (1), (2), (3);
   INSERT INTO B VALUES (3), (4), (5);

2. Execute the query:
   SELECT * FROM A INTERSECT SELECT * FROM B;

3. Observe the output:
   +------+
   | id   |
   +------+
   |  3   |
   +------+

4. Run EXPLAIN on the query:
   EXPLAIN SELECT * FROM A INTERSECT SELECT * FROM B;

5. See that MySQL internally recognizes **INTERSECT**, even though the documentation says it is not supported.

Suggested fix:
1. If INTERSECT is now officially supported in MySQL 8.0.40, update the MySQL documentation to reflect this.
2. If INTERSECT is not meant to be supported, clarify why it is working and whether it is an accidental feature or an upcoming SQL enhancement.
3. If this is an experimental feature, provide an official statement about its stability and future support.