Zend Framework 2 Advanced database operations ?

In this post i would like to list basic to advanced database queries using ZF2. I am gonna use TableGateway methods here.

Simple Select Query

SQL statement is

Select Query with Where condition

SQL statement is

Select Query with Where condition

SQL statement is

SELECT MAX(field)

SQL statement is

SELECT MIN(field)

SQL statement is

SELECT AVG(field)

SQL statement is

SELECT SUM(field)

SQL statement is

Inner Join with where condition

SQL statement is

Left join with where condition

SQL statement is

Where – OR

SQL statement is

Where – AND

SQL statement is

Where -Combined And – OR

SQL statement is

Where Combined OR – AND

SQL statement is

That’s it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.