2. SQL200 Contact Information P.O. Box 6142 Laguna Niguel, CA 92607 949-489-1472 http://www.d2associates.com [email_address] Copyright 2001-2009. All rights reserved.
9. Inner Join Older Syntax: Select <column-list> From <tablelist> Where <predicate> Still very commonly used
10. Inner Join Example using older syntax: SELECT customer_first_name, customer_street, order_numb, order_date from customers, orders Where customers.customer_numb = orders.customer_numb
28. Self Joins SELECT e.*, m.name FROM employees AS e, employees AS m WHERE e.managerid = m.employeeid;
29.
30.
31. Left Outer Join Basic SQL 92 Syntax: Select <column-list> From <table1> Left join <table2> On <join condition>
32. Left-Join Basic Example: SELECT customer_first_name, customer_street, order_numb, order_date from customers as c left join orders as o on c.customer_numb = o.customer_numb
37. Uncorrelated Subquery select isbn, quantity from orderlines ol where ol.order_numb in (select o.order_numb from orders o where order_date between #1/1/99# and #12/31/99#)
40. Negative Subquery select isbn, quantity from orderlines ol where ol.order_numb not in (select o.order_numb from orders o where order_date between #1/1/99# and #12/31/99#)
43. Correlated subquery with Exists SELECT isbn, quantity FROM orderlines AS ol WHERE exists (select * from orders o where ol.order_numb = o.order_numb and o.order_date between #1/1/99# and #12/31/99#); This type of query covered in intermediate SQL class
58. Aggregate Functions Basic syntax: Select <function>(<column>) From <table> Group by <column-list> Having <predicate> Group by all columns to left of one(s) you want to aggregate
59. Aggregate Functions SELECT orderlines.order_numb, Count(*) AS "Number of Order Lines ", Sum(orderlines.quantity) AS SumOfquantity, Sum([quantity]*[cost_each]) AS extension FROM orderlines GROUP BY orderlines.order_numb having count(*) > 1