From the course: SQL Essential Training

Unlock the full course today

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

Limiting query results

Limiting query results - SQL Tutorial

From the course: SQL Essential Training

Start my 1-month free trial

Limiting query results

- Our report has been greatly enhanced. We have aliased our columns, sorted our results. But now, we can even refine our results further. So thus far, if we take a look at our last query that we've just written, we see all of the results displayed here. If we look further in the messages pane, we can see that our results show that 60 rows returned in 14 milliseconds. So these are all 60 rows or all of the records that are contained in the customer table. Often, management may be interested in not all 60 rows but maybe a subset. Often you may want to look at the top 10 records of a result set. So we are refining our results in that we are only specifying three columns from the customer table, but we could go ahead and refine even further the results so that we don't display all 60 but instead an amount that we specify in our query. To do so, we introduce a new keyword called LIMIT, and that comes after the…

Contents