Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Databases can store massive amounts of data, and often you don't want to bring back all of the results. It's slow and it affects the performance for other users. In most cases you only want a certain subset of the rows.
SQLite, PostgreSQL and MySQL
To limit the number of results returned, use the LIMIT
keyword.
SELECT <columns> FROM <table> LIMIT <# of rows>;
MS SQL
To limit the number of results returned, use the TOP
keyword.
SELECT TOP <# of rows> <columns> FROM <table>;
Oracle
To limit the number of results returned, use the ROWNUM
keyword in a WHERE
clause.
SELECT <columns> FROM <table> WHERE ROWNUM <= <# of rows>;
Cheat Sheets
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up