How to Shuffle data

----- Original Message -----
From: <kfoneill56 [at] gmail.com>
To: "shawn wilson" <ag4ve.us [at] gmail.com>
Sent: Thursday, July 14, 2011 1:28 AM
Subject: Re: How to Shuffle data


> You could parse the URLs into different fields and save these to specific
> fields (TLD, subdomain etc) in the database
> which will then allow you to do an order by select to give the field order
> you want.
> I presume you could write a stored proc with string parsing for this in
> MySQL.
> If not you can read line by line in whatever your front end language is
> (VisualStudio/Java whatever)
> and parse the string into the components you want and save them back to
> the database
> You can then run a select on the table doing an order by on the fields you
> want.
> You can then loop through them, one by one, reconcatenate the fields to
> the format you want and save the result to your output file.
>
> I do not know mysql well enough to know if its string parsing and file
> functions can do this, I am sure it wouldn't be too hard to do in C#,
> Java, VB or whatever.
> I really doubt that you will find any function anywhere that will do the
> thing readymade and directly as you describe.
> Split the URL at the first right slash, save the right fragment as it is,
> chop of the end of the left fragment from the last dot and save the two
> left fragments.
> You can then recompose the URL in any form you want from the fragments: I
> presume you will need to retain also the original form of the URL.
> You can do an order by on fragment2, fragment1, fragment3 in your select
> query.
> It means at least two loops through the whole table, one to split the URLs
> up and save them back to the table (or a second table as you wish), the
> second to order the table and save the output to disk.
>
> Kevin O'Neill
>
> ----- Original Message -----
> From: "shawn wilson" <ag4ve.us [at] gmail.com>
> Cc: <mysql [at] lists.mysql.com>
> Sent: Wednesday, July 13, 2011 11:18 PM
> Subject: Re: How to Shuffle data
>
>
>> On Jul 13, 2011 6:41 AM, "Adarsh Sharma" <adarsh.sharma [at] orkash.com>
>> wrote:
>>>
>>> Dear all,
>>>
>>> I have million of sites stored in url column of a mysql table.
>>>
>>
>>> I need to shuffle the . words . Is there any in built function in mysql
>>> to
>> achieve this.
>>>
>>
>> Why would you want to do this in mysql? What's your programming language
>> of
>> choice? Do you have a favorite db api and csv library for that language?
>>
>> Then its just something like:
>> (+\.^\.){3}(/*$)
>> And do something with them. (warning, I just attempted at regex on a
>> phone)
>>
>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2 [at] m.gmane.org
kfoneill56 [ Do, 14 Juli 2011 02:29 ] [ ID #2062049 ]
Datenbanken » gmane.comp.db.mysql.general » How to Shuffle data

Vorheriges Thema: query for twin primes
Nächstes Thema: MySQL creating empty index?