If you have a table and want to swap two field values together, here is a simple snippet.
If you have a mysql table and want to retrieve which are duplicated for one or more rows, here is how to do this : 1) You have to group results by the column(s) itself 2) Select the column(s) and its count as well 3) Use having to only get those that their count is greater than 1
If you want to get a table column names from mysql database as a concatenated string, you can use the following code
Some times, You will find yourself trapped into a situation where you need to change a column datatype or length, But this column is already used in PK-FK relationship and the solution for this is disable the SET foreign_key_checks = 0; then change the datatype and then re-enable it after you finish the update.