From the course: Level Up: Advanced SQL

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

How many cars have been sold per employee?

How many cars have been sold per employee? - SQL Tutorial

From the course: Level Up: Advanced SQL

How many cars have been sold per employee?

(upbeat chiptune music) - [Instructor] Often, requests for data require it to be summarized in order for information and patterns to be extracted more easily from it. So far, we've been pulling raw data from across our database, using different kinds of joins to pull that data together. In our next challenge, Gabriela is asking if we can pull together a report that totals the number of cars sold by each employee. As we've already discussed, best practice suggests we avoid using SELECT star, so specify the employee ID, first and last names, and the sum of cars they've sold. Pause the video here and craft your query against the cars for all database. (upbeat chiptune music) Welcome back! This is a reasonably simple example to demonstrate the use of the GROUP BY clause. Let's first focus on the join, though. We need data from both the employee and sales tables. We'll use an inner join and specify the join criteria as…

Contents