-1

I'm a noob when it comes to MySQL.

I need to change a character after a specific character to lowercase. For example, the word in the database shows up as "it'S". I'd like to change it to be correct, which would be "it's".

I think this might do what I'm trying to do but I'm not sure.

SELECT column_name FROM table a where column = LOWER(''', '=',-1)

The column name in my case is post_title on a Wordpress based website. Thank you!

gward
  • 11
  • 2

3 Answers3

0

From a skim through the MySQL website, there seems to be an article on quotes. And, the other solution is to just take the grammatical error, and have its.

Eliter
  • 153
  • 2
  • 10
  • It'S isn't the only problem. Any word that has an apostrophe is capitalized immediately following the apostrophe. Some aren't even words. For example doesn'T, wasn'T, won'T, can'T, isn'T. The word it'S might even be It'S in which case the first character should be caps. – gward Dec 19 '15 at 05:35
0

This will lower case whatever is capitalized in that field.

UPDATE table_name SET fieldname = LOWER(fieldname)


blAh will become => blah
fOo  will become => foo

You can also build a regex using regex-MYSQLQ ..... but you will need access to the server . Here is a similar SO question.

Community
  • 1
  • 1
z atef
  • 7,138
  • 3
  • 55
  • 50
0

So from my understanding, you want to change a column name in a table, correct?

If so, try the following:

ALTER TABLE table_name CHANGE old_column_name new_column_name datatype_of_column;

Note: The datatype_of_column would be whatever your column is supposed to be. For example: INT.

Otherwise if you're trying to update a field value, try:

update table_name set column_name = value_you_want where ID = #;

If this is not the problem you face precisely, could you please be a little more specific?

Hope this helps.

Mohit G
  • 295
  • 1
  • 2
  • 14