How can I write a SQL query to replace all occurrences of space in a table with underscore and set all characters to lowercase?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To update a single column in a single table, you can use a combination of
LOWER()andREPLACE():To “duplicate” the existing column, and perform the updates on the duplicate (per your question in a comment), you can use MySQL’s
ALTERcommand before theUPDATEquery:Just be sure to update the data-type in the
ALTERcommand to reflect your actual data-type.