Wednesday, February 24, 2010

Join, subquery

/////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\
TITLES ------ SALES
1------------------ 2
2------------------ 1
3------------------ 5
4------------------ 3
: ------------------ :
1000-------------1

***********
55
select * from titles where partnum in ( select partnum from sales)
**********
98
select titles.partnum, bktitle, sldate from titles, sales
where titles.partnum = sales.partnum
*********

Outer
Left outer joined
Parent, Child
select customers.custname, sales.sldate from customers, sales
where customers.custnum = sales.custnum

select customers.custname, sales.sldate from customers join sales on
customers.custnum = sales.custnum

/////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\

&&&&&&&&&&&&&&&&&&
select customers.custname, sales.sldate from customers, sales
where customers.custnum = sales.custnum

select customers.custname, sales.sldate from customers join sales on
customers.custnum = sales.custnum

No comments:

Post a Comment