如何在MySQL中使用其他域屏蔽用户电子邮件地址?

让我们首先创建一个表-

mysql> create table DemoTable1345
   -> (
   -> UserEmailAddress text
   -> );

使用insert命令在表中插入一些记录。我们在这里插入了电子邮件地址-

mysql> insert into DemoTable1345 values('Carol123@gmail.com');
mysql> insert into DemoTable1345 values('987Sam@gmail.com');
mysql> insert into DemoTable1345 values('David_Miller@gmail.com');
mysql> insert into DemoTable1345 values('Bob@gmail.com');

使用select语句显示表中的所有记录-

mysql> select * from DemoTable1345;

这将产生以下输出-

+------------------------+
| UserEmailAddress       |
+------------------------+
| Carol123@gmail.com     |
| 987Sam@gmail.com       |
| David_Miller@gmail.com |
| Bob@gmail.com          |
+------------------------+
4 rows in set (0.00 sec)

以下是查询以掩盖MySQL中具有不同域的用户电子邮件地址-

mysql> update DemoTable1345 set UserEmailAddress=replace(UserEmailAddress, '@gmail.com','@amz.com');
Rows matched: 4 Changed: 4 Warnings: 0

让我们再次检查表记录-

mysql> select * from DemoTable1345;

这将产生以下输出-

+----------------------+
| UserEmailAddress     |
+----------------------+
| Carol123@amz.com     |
| 987Sam@amz.com       |
| David_Miller@amz.com |
| Bob@amz.com          |
+----------------------+
4 rows in set (0.00 sec)