ANSWERS: 1
  • A "FULL JOIN" is an outer join that takes *all* data from both tables, matched where it can, as opposed to a LEFT or RIGHT join that takes all the data from one table, *and* any matching records from the other table, Examples: CUSTOMER table contains details of customers DISCOUNTDEAL table contains details of different discount deals You want to see all customers, and list the discount deal they have if they have one: SELECT * FROM CUSTOMER LEFT JOIN DISCOUNTDEAL ON CUSTOMER.DEALID=DISCOUNTDEAL.DEALID You want to see all deals, and list the customers that have that deal if there are any: SELECT * FROM CUSTOMER RIGHT JOIN DISCOUNTDEAL ON CUSTOMER.DEALID=DISCOUNTDEAL.DEALID (you could also do a LEFT JOIN from DISCOUNTDEAL to CUSTOMER to achieve the same thing, of course) You want to see all deals (even it no customers are using them), and all customers (even if they don't have a deal) SELECT * FROM CUSTOMER FULL OUTER JOIN DISCOUNTDEAL ON CUSTOMER.DEALID=DISCOUNTDEAL.DEALID

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy