From the course: Database Foundations: Intro to Databases
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Sort values with ORDER BY
From the course: Database Foundations: Intro to Databases
Sort values with ORDER BY
- [Instructor] While the order that rows appear in the result set has no real world meaning, it's often useful to view them in a sequence that's easier to evaluate. When you want to read through the results in sequence, you can add an order by clause. Let's take a look by writing some more queries against our products table. Now instead of right-clicking on the two trees database and choosing new query, I can just press the control N shortcut on my keyboard. That'll jump me right into a query window for whatever database I currently had selected. So now let's start by reviewing all of the products that come in an eight ounce package. To do that, I'll write out a select statement that says select star from products dot products where size is equal to eight. When I run the query, it's going to show me how many products I have in the eight ounce size, and looking down here, I can see that we have 24 of them. Now if you…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Querying data2m 45s
-
(Locked)
Return data with SELECT and FROM6m 36s
-
(Locked)
Filter rows with WHERE4m 4s
-
(Locked)
Sort values with ORDER BY2m 43s
-
(Locked)
Combine data with JOIN4m 46s
-
(Locked)
Limiting the number of rows returned3m 35s
-
(Locked)
Solution: Write a SQL SELECT query6m 1s
-
(Locked)
-
-