Need to remove numeric data from row in MySQL [duplicate] - mysql

This question already has answers here:
remove all numeric characters from column mysql
(2 answers)
Closed 9 years ago.
I have millions of data in MySQL table, now I need to update one particular column of the table with only non-numeric characters. That is I need to remove all numbers from that column. The row wont be deleted, only updated with only non-numeric values.
I need some efficient way to achieve this.
Calling 10 times replace doesn't look good.
Thanks,
Ashish

For mysql, you just have to replace everything:
Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(column,'9',''),'8',''),'7',''),'6',''),'5',''),'4',''),'3',''),'2',''),'1',''),'0','');

Related

What is the effect of having empty tables in your database? [duplicate]

This question already has answers here:
Unused Database Table Effects
(5 answers)
Closed 3 years ago.
I have a few temporary tables that I use for a second, then clear out the data. Should I delete these tables after I finish using them or would it be okay to leave them?
It is OK to leave them.
You may wish from time to time to check the file size and run a Compact & Repair.

Delete specific entries from a column [duplicate]

This question already has answers here:
Mysql remove the specific word in comma seperated string
(6 answers)
Is storing a delimited list in a database column really that bad?
(10 answers)
Closed 5 years ago.
I already read the mysql wiki but didn't get an answer how to delete specific entries from all rows in a column.
Let's say there's a column Example.
In Example the .php wrote: "One, Two, Three, Four, Five, Six"
And you want to delete Two and Six in all rows of the column.
I don't get it how to delete those entries without having multiple commas. (Multiple commas = "One,, Three")
Thanks in Advance

In MySQL is there any function like "level" in Oracle [duplicate]

This question already has answers here:
How do I make a row generator in MySQL?
(9 answers)
Closed 7 years ago.
I'm facing a scenario, where if the input is 10, I want a sequence of numbers (1,2,3,...10).
In oracle the level function provides that function, and I wish to know how to perform the same task in MySQL.
Thanks...
You can Use this query in mysql
SET #rownr=0;
SELECT #rownr:=#rownr+1 AS `rowNumber` FROM `tablename` limit 10
the above query generate sequence of that number upto the limit.
Tablename is any of your table in db

Making a sql column UNIQUE [duplicate]

This question already has answers here:
MySQL - Make an existing Field Unique
(7 answers)
Closed 9 years ago.
Is there anyway to make a column in mysql UNIQUE with out removing it and adding it again ?
I know how to add it but i would need to remove it first but i want to edit the current column and make it UNIQUE
I do
ALTER TABLE users
ADD UNIQUE (username)
But tells me that the column username is all ready there . When i want to edit it and not add it...
Could it be that the unique index is already there?
Could it be that there already are duplicates in that column?
Check MySQL - Make a Field Unique as it might fix your problem.

mysql - auto-increment (how to auto-increment by 5) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
mysql auto_increment by 5?
I have a table that will have a column that needs to have a primary key. I want to set it to auto-increment, but it should increment by 5 or 10. I have been searching it, but it is hard to find the resource.
Does anybody know how to do it?
Thank you.
There is a server configuration setting called auto_increment_increment. Note however that this will be for all tables.