Plz share about union and union all concept in sql | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Plz share about union and union all concept in sql

Request

19th Nov 2016, 4:26 PM
Dinesh
2 Answers
+ 6
union use to combine two select statement with no duplicates. There might be some same data present in two different tables. if you not want to get those duplicates and print only one duplicate data from two or many duplicates than use Union. If you want to get all data as well as all duplicate data satisfy some condition use union all. Union all is faster than union because it does not check and than remove duplicate data from a query. Note: it does not create data or remove duplicate data to table. It is only create a virtual table from your SQL query
19th Nov 2016, 4:46 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
Union: selects only distinct values , Union all , select all
19th Nov 2016, 11:47 PM
Ozan Karataş
Ozan Karataş - avatar