17 MySQL Tutorial for Beginners: Unions - Literals - Full Outer Ioins
Add to List Share
A union combines the result sets of two or more SELECT statements into one single result set.
To code a union you use the UNION keyword to connect two or more SELECT statements.
Note that the column names in the final result set are taken from the first SELECT clause.
When you code a union, the result of each SELECT statement must have the same number of columns.
If you want to sort the result of a union operation, you can code an ORDER BY clause after the last SELECT statement.
In an ORDER BY clause, you must use the column names that are specified in the first SELECT statement. That's because the column names in the final result set are taken from the first SELECT clause.
Coding literal values instead of column specifications, could be very useful in UNIONS.
You can code literal values in the SELECT clause, to indicate which table each row in the result set came from.
You can use the UNION keyword to combine the result sets for a left and a right outer joins.
This technique is also known as âfull outer joinâ .
Because MySQL does not provide language for coding a full outer join, you can simulate it by coding an union that combines the result sets for a left outer join and a right outer join.
EXERCISES for your SELF-TRAINING:
SCRIPT FOR THE EXAMPLES:
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.
Your Cart 0
Manage research, learning and skills at NCR Works. Create an account using LinkedIn to manage and organize your omni-channel knowledge. NCR Works is like a shopping cart for information -- helping you to save, discuss and share.