From the course: SQL for Non-Programmers

Unlock the full course today

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

Putting order to your data with ORDER BY

Putting order to your data with ORDER BY - SQL Tutorial

From the course: SQL for Non-Programmers

Putting order to your data with ORDER BY

We typically don't want to retrieve our data randomly. Ordering data in SQL is important because it allows you to arrange and present your data in a meaningful way. This will definitely be helpful as we prepare insights for the management team at Two Trees Olive Oil. We have already learned the SELECT, FROM, and LIMIT clauses. The ORDER BY clause placed after the FROM clause is used to sort data in ascending or descending order, based on one or more columns. By ordering your data, you can easily identify patterns and trends, find the highest or lowest values, and begin to draw insights and conclusions. Let's return to our previous query in SLS, pulling general order details to explore the sales data table and add some order to our data. Let's return to our previous query in SLS, pulling general order details to explore the sales data table, and let's add some order to our data. If we execute this query again, you'll notice in the output that the rows are retrieved in a random order…

Contents