Tema: Re: Reikia pagalbos su SQL
Autorius: 2x50
Data: 2011-05-13 09:54:14
> na kazkokia mistika su ta duombaze
>
> jeigu I selecto from dadedu ta prekiu lentele ir nei vieno lauko is ten 
> neselectinu ir neoperuoju su ja where dalyje is karto uzklausos atlikimo 
> laikas auga tragiskai

Siaip smalsu, kas vercia zmones deti lenta i from dali, jei ji neatlieka nei 
duomenu isrinkimo, nei filtravimo fukcijos? Jokios mistikos cia nera, nes 
pridedamas be join'o lenta, gausi ne ka kita kaip
Cartesian Join
Every possible combination of the elements of two or more sets. For example, 
a Cartesian join of (A,B) and (1,2,3) is (A,1) (A,2) (A,3) (B,1) (B,2) 
(B,3). Try it with larger set sizes and you will quickly realize why it can 
be very unpleasant. Accidental usage has been known to bring systems to a 
crawl.

That is not every combination - it's taking exactly one element from each 
set (in every way possible).

  a.. How about "every combination of pairing".

SQL example:

   SELECT a.cust_id, b.product_id, b.product_name
     FROM order a, product b

Without a specification of how the join is to be done, the DB will blithely 
return, for every row in order, all of the rows in product. If you have 
4,000 orders and 200 products you will get back 800,000 rows of nonesense.