I'm new SQL and although I can create a database, update it, insert, select etc....I've come across a challenge that I'm hoping someone can help me with. I've got a daily news table with about 2,700 rows or news items. I would like to give my users the ability to view the items in the table sorted by date, category, and source of news.
Here's where the I run up against the challenge...I have created a select statement for the table but I it will return too many items! How can I limit the number of items returned from the database? I'm sure there is a simple solution to the problem I just can't seem to find it...
Say you have the query
"select * from table"
you can make it
"select * from table limit 10"
That will select the first 10 items in the db.
Or you may want to select the 8 most recent items (if there is a date column with the timestamp the item was posted)
"select * from table ORDER BY date DESC LIMIT 8"
Bookmarks