Simple fluent SQL Query Builder using method chaining.
table()β set table nameselect()β choose columnscount()β count rowsaggregate()β use SUM, AVG, MAX, MIN
where()β AND conditionwhereOr()β OR conditionwhereIn()β multiple values matchwhereBetween()β range conditionwhereNull()β NULL checkwhereExists()β subquery checklike()β search pattern
groupBy()β group similar rowshaving()β filter grouped datahavingGroup()β multiple HAVING conditions
join()β combine tablesunion()β merge queries
orderBy()β sort results ASC/DESC
limit()β limit resultsoffset()β skip results
distinct()β remove duplicatestoSQL()β generate final SQL query
$query = $instance
->table('users')
->select('name')
->count('name')
->groupBy('name')
->having('COUNT(name) > 1')
->orderBy('name', 'ASC')
->limit(10)
->offset(5)
->toSQL();
echo $query;