From the course: Database Foundations: Intro to Databases

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Sort values with ORDER BY

Sort values with ORDER BY

From the course: Database Foundations: Intro to Databases

Start my 1-month free trial

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…

Contents