· 9 years ago · Jan 10, 2017, 12:50 PM
1 /*
2 *
3 * Columns in SQL queries are sometimes expressions, not simply column names from a table. Expressions should not have correlation names or quoting applied. If your column string contains parentheses,
4 * Zend_Db_Select recognizes it as an expression. You also can create an object of type Zend_Db_Expr explicitly, to prevent a string from being treated as a column name.
5 * Zend_Db_Expr is a minimal class that contains a single string.
6 * Zend_Db_Select recognizes objects of type Zend_Db_Expr and converts them back to string, but does not apply any alterations, such as quoting or correlation names.
7 * Note: Using Zend_Db_Expr for column names is not necessary if your column expression contains parentheses; Zend_Db_Select recognizes parentheses and treats the string as an expression,
8 * skipping quoting and correlation names.
9 *
10 * ---
11 *
12 * Note the empty array() in the above example in place of a list of columns from the joined table.
13 * SQL has several types of joins. See the list below for the methods to support different join types in Zend_Db_Select.
14 * INNER JOIN with the join(table, join, [columns]) or joinInner(table, join, [columns]) methods.
15 * - This may be the most common type of join. Rows from each table are compared using the join condition you specify. The result set includes only the rows that satisfy the join condition.
16 * The result set can be empty if no rows satisfy this condition.
17 * - All RDBMS brands support this join type.
18 * LEFT JOIN with the joinLeft(table, condition, [columns]) method.
19 * - All rows from the left operand table are included, matching rows from the right operand table included, and the columns from the right operand table are filled with NULL if no row exists matching the left table.
20 * - All RDBMS brands support this join type.
21 * RIGHT JOIN with the joinRight(table, condition, [columns]) method.
22 * - Right outer join is the complement of left outer join. All rows from the right operand table are included, matching rows from the left operand table included,
23 * and the columns from the left operand table are filled with NULL's if no row exists matching the right table.
24 * - Some RDBMS brands don't support this join type, but in general any right join can be represented as a left join by reversing the order of the tables.
25 * FULL JOIN with the joinFull(table, condition, [columns]) method.
26 * - A full outer join is like combining a left outer join and a right outer join. All rows from both tables are included, paired with each other on the same
27 * row of the result set if they satisfy the join condition, and otherwise paired with NULL's in place of columns from the other table.
28 * - Some RDBMS brands don't support this join type.
29 * CROSS JOIN with the joinCross(table, [columns]) method.
30 * - A cross join is a Cartesian product. Every row in the first table is matched to every row in the second table. Therefore the number of rows in the result set is equal to the product
31 * of the number of rows in each table. You can filter the result set using conditions in a WHERE clause; in this way a cross join is similar to the old SQL-89 join syntax.
32 * - The joinCross() method has no parameter to specify the join condition. Some RDBMS brands don't support this join type.
33 * NATURAL JOIN with the joinNatural(table, [columns]) method.
34 * - A natural join compares any columns that appear with the same name in both tables. The comparison is equality of all the columns; comparing the columns using inequality is not a natural join.
35 * Only natural inner joins are supported by this API, even though SQL permits natural outer joins as well.
36 * - The joinNatural() method has no parameter to specify the join condition.
37 *
38 * In addition to these join methods, you can simplify your queries by using the JoinUsing methods. Instead of supplying a full condition to your join, you simply pass the column name on which to join and the
39 * Zend_Db_Select object completes the condition for you.
40 *
41 *
42 */