I have a database with a fair number of words in a table.
I basically need a SQL statement which will replace each vowel (a,e,i,o,u) with the next vowel along alphabetically)
e.g.
Hello --> Hillu
Morning --> Murnong
Stubborn --> Stabburn
I looked up REPLACE and TRANSLATE however they do not seem to be available in SQLite. Any help guys, even if its just the actual function call I need. I could probably work the rest myself, but cannot find anything via google.
SQLite Help Required
Page 1 of 17 Replies - 658 Views - Last Post: 14 February 2011 - 12:38 PM
Replies To: SQLite Help Required
#2
Re: SQLite Help Required
Posted 14 February 2011 - 12:16 PM
#3 Guest_Brad*
Re: SQLite Help Required
Posted 14 February 2011 - 12:25 PM
#4
Re: SQLite Help Required
Posted 14 February 2011 - 12:28 PM
What version of SQLite?
#5 Guest_Guest*
Re: SQLite Help Required
Posted 14 February 2011 - 12:30 PM
#6
Re: SQLite Help Required
Posted 14 February 2011 - 12:35 PM
sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select replace('hello', 'e', 'i');
hillo
sqlite>
#7
Re: SQLite Help Required
Posted 14 February 2011 - 12:37 PM
Well, databases aren't real into string manipulation. Particularly sqlite, where it's assumed you'll be calling from a middle tier that would be far more suited.
Still, in the interests of silliness, and proof of concept, this worked:
Still, in the interests of silliness, and proof of concept, this worked:
baavgai@DIC:~$ sqlite3 foo.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table foo(s text);
sqlite>
sqlite> insert into foo values('Hello');
sqlite> insert into foo values('Morning');
sqlite> select * from foo;
Hello
Morning
sqlite> select s,
...> replace(replace(replace(replace(s,'o','u'),'i','o'),'e','i'),'a','e')
...> from foo;
Hello|Hillu
Morning|Murnong
sqlite>
#8 Guest_Guest*
Re: SQLite Help Required
Posted 14 February 2011 - 12:38 PM
JackOfAllTrades, on 14 February 2011 - 12:35 PM, said:
sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select replace('hello', 'e', 'i');
hillo
sqlite>
Running the latest SQLite engine I can get that to work fine, however using the admin's current database does not seem to recognize REPLACE.
Oh well, i guess a bit of a more long winded method is in order then, thanks anyway dude!
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote








|