Website Development Prices

Search Blog

Wednesday, October 7, 2015

Tipovi spojeva u MySQL-u (Types of joins in MySQL)

Dekartov proizvod - daje sve kombinacije svih redova iz svih spojenih tabela. Imena tabela razdvajaju se zarezima, a odredba where se ne zadaje.

Puni spoj - isto kao prethodni.

Unakrsni spoj - isto kao prethodni. Izmedju imena tabela koje spajate mozete zadati rezervisane reci
cross join

Unutrasnji spoj - semanticki ekvivalentan zarezu. Mozete zadati rezervisane reci inner join. Ako ne zadate uslov pomocu odredbe where, ovaj tip spoja ekvivalentan je punom spoju. Da bi ste od ovog uslova napravili pravi unutrasnji spoj, zadajte uslov u odredbi where

Jednakovredni spoj - uparuje redove iz tabela u spoju pomocu uslovnog  izraza i operatora =. U standardnom SQL-u to je spoj sa odredbom where.



Levi spoj - uparuje redove iz tabela u spoju, s tim sto za redove iz leve tabele  koji nemaju parove u desnoj tabeli  dodaje vrednost null. U standardnom SQL-u obavezne su rezervisane reci left join.  Koriste se za pronalazenje vrednosti koje nemaju odgovarajuce parove. Postoji i varijanta sa right join.

Cartesian product - provides all combinations of all rows from all the connected tables. Table names are separated by commas, you don't use clause where.

Full join - the same as previous.

Cross-join - same as previous. Among the names of the tables that you are joining you can specify reserved words CROSS JOIN.

Inner join - semantically equivalent to a comma. You can specify reserved words INNER JOIN. If you do not enter a condition using the WHERE clause, this type of join is equivalent to a full join. If you want to get real inner join, from this condition, set a condition in the WHERE clause.

Equivalent join - matched rows from the table in join using conditional expressions and operator =. In standard SQL it is a join with a WHERE clause.

Left join - matched rows from the table in join, except that the rows from the left table that have no pairs in the right table adds value NULL. In standard SQL are required reserved words LEFT JOIN. They are used to retrieve the values ​​that have matching pairs. There is also a variant with a RIGHT JOIN.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.