Win has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: SQL solution or Perl solution?
by planetscape (Chancellor) on Nov 07, 2007 at 00:48 UTC

    RAND function, from the Transact-SQL Reference (SQL Server 2000).

    HTH,

    planetscape
Re: SQL solution or Perl solution?
by tuxz0r (Pilgrim) on Nov 06, 2007 at 19:09 UTC
    I agree that some clarification is needed. If this is just for a lookup table there's no need to randomly duplicate data, as you can just have a lookup table with an integer key and have the outside code that does the lookup use a rand() or some other function to derive a random entry from the table. I'll wait for some more explanation, too.

    ---
    echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'

      You actually don't even need to do that...
      select * from my_table order by rand();
      will tell MySQL to randomize the record order. I assume most other database engines have a similar capability, although I wouldn't necessarily expect the syntax to be the same.
        I didn't recognize 'identity' so I didn't think this was MySQL. I think it's either SQL Server or Sybase because of the TSQL part. Inserting random strings via perl is easy. Use Perl's DBI package. Like the rest of you, I'm waiting for some more clarification.
        --
        I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re: SQL solution or Perl solution?
by amarquis (Curate) on Nov 06, 2007 at 18:32 UTC

    Clarification question: Is the goal to have the lookup table or to have the lookup table in a database? What I'm asking is, are you looking for Perl to help you with the database insertions, or a Perl solution that is its own lookup table (bypassing the database implementation).

    Curiosity question: What will you be using the table for?

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: SQL solution or Perl solution?
by jdporter (Paladin) on Nov 07, 2007 at 14:10 UTC

    Since you seem to think Perl offers the likeliest solutions to all your problems, you should just learn Perl.

Re: SQL solution or Perl solution?
by nedals (Deacon) on Nov 08, 2007 at 03:45 UTC

    With judicious use of my crystal ball....

    Put your government regions into an array (0..353)
    Using perl and upon request, output the array in random order.

    I'll guess that you do not really want to create 10,000 arrays. Simply create a random array as needed.