Laravel theorytheory 0/50 · 0%
Database · easy

15. Query Builder

Fluent SQL without raw strings.

The Query Builder (DB::table('users')) provides a fluent, database-agnostic interface for building SQL queries without writing raw SQL. It supports where clauses, joins, ordering, grouping, and aggregate functions like count() and sum(). It's often used for complex queries that don't map cleanly to Eloquent models.

Check your understanding

  1. 1. Which facade starts a Query Builder query?

  2. 2. How do you get the count of matching rows?