Skip to content

Instantly share code, notes, and snippets.

@moaalaa
Created August 14, 2023 14:49
Show Gist options
  • Save moaalaa/e5a68804c46563ef974d732de5ff9024 to your computer and use it in GitHub Desktop.
Save moaalaa/e5a68804c46563ef974d732de5ff9024 to your computer and use it in GitHub Desktop.
prefix columns in mysql
# One Columns
UPDATE users SET email = CONCAT('lab_', email)
# Two Columns
UPDATE users SET email = CONCAT('lab_', email), phone = CONCAT('lab_', phone)
# Two Columns with condition
UPDATE users SET email = CONCAT('lab_', email), phone = CONCAT('lab_', phone) where type != 'admin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment