Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via Email

MySQL Union

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.



Syntax

SELECT statement1
Union
SELECT statement2
Union
SELECT statement3....


Example of Union

SELECT student_name from student_info where student_id = '3'
Union
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

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH

Check Out SEMRUSH