An easy-to-use and IDE friendly SQL builder
$db = new \PDO($dsn, $username, $passwd);
$res = Sql::select('a, b')
->from('table')
->leftJoin('table1')->on('table.id=table1.id')
->where('a=?',1)
->groupBy('b')->having('sum(b)=?', 2)
->orderBy('c', Sql::$ORDER_BY_ASC)
->limit(0,1)
->forUpdate()->of('d')
->get($db);
$rows = Sql::update('table')
->set('a', 1)
->where('b=?', 2)
->orderBy('c', Sql::$ORDER_BY_ASC)
->limit(1)
->exec($db)
->rows
$newId = Sql::insertInto('table')
->values(['a'=>1])
->exec($db)
->lastInsertId()
$rows = Sql::deleteFrom('table')
->where('b=?', 2)
->orderBy('c', Sql::$ORDER_BY_ASC)
->limit(1)
->exec($db)
->rows