h1

Totul despre join-uri (join, left join, right join,inner join,cross join)

November 12, 2009

Join simplu cand vrem o reuniune simpla a anumitor coloane din anumite tabele. (listarea informatiilor din anumite tabele contine si functia agregat AVG pt.media aritmetica a valorilor continute in coloana CombustibilConsumat):

ex_join

Diferenta intre join-uri privind cele 2 cercuri ca cele 2 multimi. Ceea ce este cu rosu va fi rezultatul intors de cerere (query):

joins

Intre FROM si join se pune clauza WHERE doar daca nu avem functie agregat.

In cazul de fata o conditie cand avem functie agregat in SELECT se pune acea conditie folosind doar clauza HAVING (creata special pt.a  pune conditii atunci cand in select avem functii agregat).

CROSS JOIN pt.2 tabele in mssql: (produsul cartezian a 2 tabele similar produsului cartezian a 2 multimi, practic o tabela e o multime de date):

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: