From the course: Database Foundations: Intro to Databases

Unlock the full course today

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

Limiting the number of rows returned

Limiting the number of rows returned

- [Narrator] All of the select queries, that we've looked at so far, will run identically on either SQL Server or PostgreSQL. The command syntax is exactly the same, for these select, from, join, where and ORDER BY clauses. However, this next example is a little bit different. When you want to limit the number of rows returned by the query, each platform takes a slightly different syntax. Let's start with SQL Server. I'm going to select something inside of my two trees database and then press control, enter on my keyboard, to open up a new query window attached to that database. I want to first review all of the product data sorted by price descending. To do that we'll select star or select all of the columns from product stock products, ORDER BY price descending. When I press run, I can see the following results. This place is the highest price products at the top of the results. Now, if I only wanted to see the first five…

Contents