/*
The `customers` table stores customers' full names in the `full_name` column,where names are stored
in the format `First Middle Last`.  

Write a query to:  
1. Extract only the first name from the `full_name` column.  
2. Extract only the last name from the `full_name` column.  
3. Extract the domain of the email address (everything after the `@`).  

Input (customers table):
| customer_id | full_name           | email_address                  |  
|-------------|---------------------|--------------------------------|  
| 1           | John Doe Smith      | john.doe.smith@gmail.com       |  
| 2           | Jane Alice Brown    | jane.brown@hotmail.com         |  
| 3           | Mark Alan Lee       | mark.lee@yahoo.com             |  
| 4           | Alice Carol White   | alice.white@outlook.com        |  
| 5           | Bob Charlie Davis   | bob.davis@icloud.com           |  
| 6           | Emma Grace Taylor   | emma.taylor@company.com        |  
| 7           | Lucas Henry Johnson | lucas.johnson@business.org     |  
| 8           | Mia Sophia Green    | mia.green@university.edu       |  

Expected Output: 
| customer_id | first_name | last_name | email_domain       |  
|-------------|------------|-----------|--------------------|  
| 1           | John       | Smith     | gmail.com          |  
| 2           | Jane       | Brown     | hotmail.com        |  
| 3           | Mark       | Lee       | yahoo.com          |  
| 4           | Alice      | White     | outlook.com        |  
| 5           | Bob        | Davis     | icloud.com         |  
| 6           | Emma       | Taylor    | company.com        |  
| 7           | Lucas      | Johnson   | business.org       |  
| 8           | Mia        | Green     | university.edu     |  
*/

CREATE TABLE customers (
    customer_id INT,
    full_name VARCHAR(20),
    email_address VARCHAR(30)
);

INSERT INTO customers (customer_id, full_name, email_address) VALUES
(1, 'John Doe Smith', 'john.doe.smith@gmail.com'),
(2, 'Jane Alice Brown', 'jane.brown@hotmail.com'),
(3, 'Mark Alan Lee', 'mark.lee@yahoo.com'),
(4, 'Alice Carol White', 'alice.white@outlook.com'),
(5, 'Bob Charlie Davis', 'bob.davis@icloud.com'),
(6, 'Emma Grace Taylor', 'emma.taylor@company.com'),
(7, 'Lucas Henry Johnson', 'lucas.johnson@business.org'),
(8, 'Mia Sophia Green', 'mia.green@university.edu');

SELECT 
    customer_id,
    SUBSTRING_INDEX(full_name, ' ', 1) AS first_name,
    SUBSTRING_INDEX(full_name, ' ', -1) AS last_name,
    SUBSTRING_INDEX(email_address, '@', -1) AS email_domain
FROM customers;

Embed on website

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