/*
You are working with a `customers` table that contains the following columns:  

| Column Name       | Data Type     | Description                                         |  
|-------------------|---------------|-----------------------------------------------------|  
| `customer_id`     | INT           | Unique ID for each customer                         |  
| `email_address`   | VARCHAR(100)  | Email addresses that may contain invalid characters |  
| `phone_number`    | VARCHAR(15)   | Customer's phone number                             |  

The `email_address` column contains email addresses where some invalid characters
(like `#` and `%`) are mistakenly used in place of `@` or `_` (e.g., `john#doe%gmail.com`).  

Task:
Write a query to clean the `email_address` column by:  
1. Replacing the `#` character with `_`.
2. Replacing the `%` character with `@`.
3. Display the cleaned email addresses along with `customer_id`.  

Sample Input (customers table):  
| customer_id | email_address           | phone_number   |  
|-------------|-------------------------|----------------|  
| 1           | john#doe%gmail.com      | 1234567890     |  
| 2           | jane#doe%yahoo.com      | 9876543210     |  
| 3           | mark#smith%hotmail.com  | 5556667777     |  

Expected Output:
| customer_id | cleaned_email_address   |  
|-------------|--------------------------|  
| 1           | john_doe@gmail.com       |  
| 2           | jane_doe@yahoo.com       |  
| 3           | mark_smith@hotmail.com   |  
*/

CREATE TABLE customers (
    customer_id INT,
    email_address VARCHAR(100),
    phone_number VARCHAR(15)
);

INSERT INTO customers (customer_id, email_address, phone_number) VALUES
(1, 'john#doe%gmail.com', '1234567890'),
(2, 'jane#doe%yahoo.com', '9876543210'),
(3, 'mark#smith%hotmail.com', '5556667777'),
(4, 'alice#brown%outlook.com', '4445556666'),
(5, 'bob#white%icloud.com', '1112223333'),
(6, 'emma#jones%company.com', '7778889999'),
(7, 'lucas#johnson%business.org', '9998887777'),
(8, 'mia#lee%university.edu', '6665554444');

SELECT
    customer_id,
    REPLACE(REPLACE(email_address,'%','@'),'#','_') AS cleaned_email_address
FROM customers;

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: