Created
September 8, 2020 14:09
-
-
Save yohangdev/796beabfb7a00e1c3940743a54381460 to your computer and use it in GitHub Desktop.
Cheatsheet for common data cleansing with mySQL (Phone Number, NIK, dsb)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM table WHERE phone_number REGEXP '^\\+62'; | |
UPDATE table | |
SET phone_number = REPLACE(phone_number, '+62', '0') | |
WHERE phone_number REGEXP '^\\+62'; | |
####### | |
SELECT * FROM table WHERE phone_number REGEXP '-'; | |
UPDATE table | |
SET phone_number = REPLACE(phone_number, '-', '') | |
WHERE phone_number REGEXP '-'; | |
####### | |
SELECT * FROM table WHERE nik REGEXP ' '; | |
UPDATE table | |
SET nik = REPLACE(nik, ' ', '') | |
WHERE nik REGEXP ' '; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment