- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can INTERSECTION between tables be implemented with the help of MySQL joins?
Actually, INTERSECTION is just an inner join on all columns. We are taking a simple example of two tables, having the data as follows −
mysql> Select * from value1; +------+------+ | i | j | +------+------+ | 1 | 1 | | 2 | 2 | +------+------+ 2 rows in set (0.00 sec) mysql> Select * from value2; +------+------+ | i | j | +------+------+ | 1 | 1 | | 3 | 3 | +------+------+ 2 rows in set (0.00 sec)
Now, the following query will do the INTERSECTION between these tables −
mysql> Select * from value1 join value2 using(i,j); +------+------+ | i | j | +------+------+ | 1 | 1 | +------+------+ 1 row in set (0.08 sec)
Advertisements