Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Ordering
2. Get to know the tables
Limiting the output
Eliminating duplicate results
Aggregation
Grouping
HAVING: filtering and ordering groups
Let's practice

Instruction

Great! Let's have a look at the tables we're going to work with. If you've had enough of cars and movies already, here's a good piece of news: we're going to discuss orders and employees this time! We'll provide you with examples based on a table named Order:

Order (OrderId, CustomerId, OrderDate, ShipDate, TotalSum);

Not very complicated, as you can see.

Each order has an ID (OrderId), was made by a specific customer (CustomerId) on a specific day (OrderDate), and was shipped on a specific day (ShipDate). The total value of an order is contained in the column TotalSum.

Exercise

Now, take a look at the table we'll use for exercises. Here, we have employees with their salaries in specific years.

Naturally, one employee can work for more than one year, so there may be many rows for the same person, usually with different salaries each year.

The employees work in specific departments and have a certain position, which may change as the employee gets promoted.

Study the table for a moment, and then click the Next exercise button to move on.