To achieve this, you'll need to install the `mysql-connector-python` package. You can do that by running:

```bash
pip install mysql-connector-python
```

Here's a Python script that connects to a MariaDB database, creates a table called "users", inserts sample data into the table, and retrieves all users whose age is between 18 and 30.

```python
import mysql.connector

# Replace these values with your own MariaDB credentials
db_config = {
    'user': 'your_username',
    'password': 'your_password',
    'host': 'localhost',
    'database': 'your_database'
}

# Connect to the database
cnx = mysql.connector.connect(**db_config)
cursor = cnx.cursor()

# Create the "users" table
cursor.execute("""
CREATE TABLE IF NOT EXISTS users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    age INT NOT NULL
)
""")

# Insert sample data into the "users" table
sample_data = [
    ('Alice', 'alice@example.com', 25),
    ('Bob', 'bob@example.com', 19),
    ('Charlie', 'charlie@example.com', 31),
    ('David', 'david@example.com', 22)
]

insert_query = """
INSERT INTO users (name, email, age) VALUES (%s, %s, %s)
"""

for user in sample_data:
    try:
        cursor.execute(insert_query, user)
    except mysql.connector.IntegrityError as e:
        print(f"Error inserting {user[1]}: {e}")

cnx.commit()

# Retrieve all users whose age is between 18 and 30
select_query = """
SELECT * FROM users WHERE age BETWEEN 18 AND 30
"""
cursor.execute(select_query)

print("Users aged 18-30:")
for (user_id, name, email, age) in cursor:
    print(f"{name} ({email}), {age} years old")

# Close the database connection
cursor.close()
cnx.close()
```

Make sure to replace `'your_username'`, `'your_password'`, and `'your_database'` with your actual MariaDB credentials.
Write a Python script that connects to a MariaDB database, creates a table called "users" with columns for id, name, email, and age, and inserts sample data into the table. Then, write a query to retrieve all users whose age is between 18 and 30.
