Horje
sql union Code Example
sql union
-- UNION: distinct values (slower)
SELECT emp_name AS name from employees
UNION       
SELECT cust_name AS name from customers;

-- UNION ALL: keeps duplicates (faster)
SELECT emp_name AS name from employees
UNION ALL      
SELECT cust_name AS name from customers;
union SQL
SQL> SELECT  ID, NAME, AMOUNT, DATE
   FROM CUSTOMERS
   LEFT JOIN ORDERS
   ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID
UNION
   SELECT  ID, NAME, AMOUNT, DATE
   FROM CUSTOMERS
   RIGHT JOIN ORDERS
   ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;




Sql

Related
sql query interview questions Code Example sql query interview questions Code Example
select current_timestamp - interval '3 days'; Code Example select current_timestamp - interval '3 days'; Code Example
mysql dump with table query Code Example mysql dump with table query Code Example
mysql count rows returned Code Example mysql count rows returned Code Example
sql find second highest salary employee Code Example sql find second highest salary employee Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6