
Choosing Random Items from a MySQL Table
At one time or another, most of us find the need to display a random item from a batch of items on our Web site. Whether you are displaying a random banner or promotional item on your home page, or displaying a random post on your blog, you need to know how to do so effectively and efficiently. This article will show you two ways to do so. First, you can use the RAND() function within MySQL. To do that, you would simply use something like: SELECT * FROM table ORDER BY RAND() LIMIT 1; That will return a single random result from your table. That’s the simple way to select a random item from your table. Using the LIMIT part of that query, you could actually select…










|
cmartinez (Carlos Martnez U.) : RT @uvmbdt: Urge programador que domine MySQL, enva tu CV a fosnaya@uvmnet.edu.. Updated : 2010-03-19T02:40:28Z | Reply | View Tweet |
|
ronin4rent (Antonio Frye, Jr.) : Twitter Drops MySQL For Cassandra -- Cloud databases -- InformationWeek: http://bit.ly/bk0sss via @addthis.. Updated : 2010-03-19T02:38:44Z | Reply | View Tweet |
|
RKajiyama (Ryusuke Kajiyama) : MySQL????????Oracle????REDO????????????? RT @knaka ?????????????????Oracle???REDO????PostgreSQL???WAL??????????.. Updated : 2010-03-19T02:37:35Z | Reply | View Tweet |
|
sadamumu (???) : mysql> select user, host, password from mysql.user;.. Updated : 2010-03-19T02:36:38Z | Reply | View Tweet |
|
RKajiyama (Ryusuke Kajiyama) : MySQL?????????????????????????????????General Log???????????????????????????????????InnoDB?REDO????????InnoDB??? RT @knaka Updated : 2010-03-19T02:36:09Z | Reply | View Tweet |
-
Google Code University - Free Training from Google
[Programming]Want to learn how to program? Develop in mySQL? Enhance your skills as a developer or programmer or just learn the lingo. Tutorials, lecture slides, and problem sets for a variety of topic areas including AJAX, Distributed Systems, Web Security, Languages and a ton of other great classes - at no cost!
-
Sun buys MySQL
[Tech Industry News]Didn't see that one coming. Blog contains details to what this could mean for both companies. May as well be one of the most important takeovers of 2008 already!
-
Please Crash my HTTP server.
[Linux/Unix]I am trying to stress test my server to see how much load it can take. I recently tried a decent amount of optimization through php-cache, mysql-cache, eaccelarator, apache optimization and so on and so forth. I wanted to generate a real-life stress scenario. If you think this is some kind of ploy to get some traffic, feel free not to click it.
-
Tutorials Round-Up: Ajax, CSS, JavaScript, PHP, MySQL and Much More
[Design]200 hand-picked references to Ajax, CSS, Flash, JavaScript, PHP, MySQL, RSS, XML, ASP, C++, Perl, Python and Java tutorials. Handy and useful.
-
Fake Name Generator goes FREE
[Software]Get 20,000 real looking fake identities for free in several formats -- CSV, MySQL, Excel, etc. -- instead of paying the normal $30 fee. Works great for testing databases or signing up for online sites!




























