how to change all records of a specific field in mysql


Problem :

I have a table topMovies containing 100,000 records. Table fields are Id, name, movieId and year. Data in movieId field are stored like (/title/tt0111161/, ...), also in the field "year", data are inside parentheses for example (2008) instead of 2008.

Could someone kindly help me how I can change them to tt0111161 and 2008? (I mean deleting other characters like /title/ for movieId and () for year?

Thanks a lot,



Solution :

Try this

UPDATE topMovies
SET movieId = REPLACE(REPLACE(movieId,'/title/',''),'/',''),
year = REPLACE(REPLACE(year,'(',''), ')','')

Mysql Tutorials

Mysql Howto..

How to release memory of mysql connection open when working on c# [closed]

Laravel: How to rename reserved word column in MySQL?

How to do a MySQL select query on two tables linked by another table

How to explicitly sort by the default sort order in MySQL?

How to use the optimizer_search_depth in mysql?

MySQL how to log thread connections (I need user and ip)

How to store video tags into a database (MySQL)?

How to Remove matching rows From mysql Join Result and show non-matching rows?

Inconsistencies with how MySQL stores INT?

How can I see the final MySQL column value in a trigger even if it wasn't part of the update data?

PHP how to include everything i type in my textbox to mysql database [duplicate]

How to find old rows not in the top 10 and delete them using MySQL

how to load data from local file in php with pdo driver

How can i get last row of specific id in mysql? [duplicate]

How to get MySQL case statement to work inside a stored procedure?

How facebook store and access text data

How to make MYSQL query results ORDER BY conditions order?

How to Display Data in C# form mysql table?

PHP/MySQL How to prioritize rows in table via admin panel

Mysql: how to fetch ratings data

How to escape quotes “” characters in MySQL and Java

How to make MySQL Connector/J working on android?

Mysql: How to see the compile time configs of a mysql binary

How to connect to MySQL via Standard TCP/IP over SSH using go-sql-driver?

How to configure MySQL under Zend Framework?

How to reuse a huge query in MySQL

How to create trigger in mysql?

How to compare elapsed time between datetime fields?

How to upload Excel or CSV to MySQL data base using PHP?

How to process array element into MySQL with PHP?