Max Titov IV @ TechSplice

The most beautiful music of all is the music of what happens.
  • Home
  • About

Posts Tagged ‘database’

6 May 2009

SQL: SELECT random number of rows

Here’s a quick way of requesting a random number of rows from a MySQL database:

SELECT * FROM <tablename> order by rand() limit <n>;

tablename: is the name of the table you wish to access

n: is thenumber of rows you wish to return

Be careful though, don’t use this logic on a database with a large record, the performance will be unpleasant.

6 May, 2009 at 12:17 by Max

Tags: database, random, select, sql
Posted in Everyday stuff | No Comments »

  • Subscribe using FeedBurner
  • Cloud

    abap adobe animation basic beautiful builder camera code configuration contribution design development digital engineering fix flash Flex friends function images interesting lesson new paypal Photography php problem problems program programmer review sap SAP/ABAP sdk setup soap software solution story system tables transaction transports user video

    WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.

  • My Links

    • Cooking
    • Gallery
    • Resume
  • Online Tools

    • Airline Ticket Search
    • Estimate Shipping Cost [from US]
    • Link your Blog
  • Software Engineering Blogs

    • Adam Goucher
    • Joel on Software
    • The Third Bit
    • Wide Awake Developers
  • Categories

    • Everyday stuff
    • Flex
    • Photography
    • SAP/ABAP
    • Short Stories
    • Software Engineering
    • Web Development
  • Gallery

    Roy Tanck's Flickr Widget requires Flash Player 9 or better.

Max Titov IV @ TechSplice is proudly powered by WordPress
Design & code by Jonk
Entries (RSS) and Comments (RSS).
Podcast Powered by podPress (v8.8)