From the course: Introduction to SQL Using Google BigQuery
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
ORDER BY clause - SQL Tutorial
From the course: Introduction to SQL Using Google BigQuery
ORDER BY clause
- [Instructor] We can learn a lot from our data by simply sorting it in a particular order. The ORDER BY clause allows us to do this with BigQuery. For this example, let's say we wanted to look at the product_id, product_name, and retail_price columns from the product table. This simple SELECT statement should work. But what if we wanted to order our products using the retail price? If we wanted to sort our products from least to most expensive using the retail_price column, we can add an ORDER BY clause at the end of our query. This is shown here with the ORDER BY retail_price, following the line with the FROM wisdom_pets.products. By default, when we use ORDER BY, it will sort columns or expressions from smallest to largest, also known as ascending order. This behavior can be explicitly coded in BigQuery by using ASC after the retail_price column input in the ORDER BY clause. If instead, we wanted to sort our output…
Contents
-
-
-
-
(Locked)
SELECT statement9m 29s
-
(Locked)
ORDER BY clause4m 53s
-
(Locked)
WHERE clause conditional logic5m 55s
-
(Locked)
WHERE clause BETWEEN and IN7m 6s
-
(Locked)
Fuzzy string matching5m 47s
-
(Locked)
COUNT function6m 35s
-
(Locked)
Calculation functions7m 58s
-
(Locked)
Challenge: Wisdom Pet, quiz 11m 47s
-
(Locked)
Solution: Wisdom Pet, quiz 110m 48s
-
(Locked)
-
-
-
-