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 already had enough of cars and movies, 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 the orders table:

orders (order_id, customer_id, order_date, ship_date, total_sum)

Not very complicated, as you can see.

Each order has an id (order_id), was made by a specific customer (customer_id) on a specific day (order_date), as well as shipped on a specific day (ship_date). The total value of the order is contained in the column total_sum.

Exercise

So much for the example table.

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 Next exercise to move on.