All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

MySQL Union

MySQL Union is also like a Joins it combines data from two or more tables but it combines rows from two or more result sets.


SELECT statement1
SELECT statement2
SELECT statement3....

Example of Union

SELECT student_name from student_info where student_id = '3'
SELECT name from student_marks where sid = '3'

Code Explanation

  • In this it gets all the rows where student_id and id is equal to 3 and combine the result set and display them.

❮ PrevNext ❯