You are working as a Data Engineer for an e-commerce platform. The business team wants to identify customers who have signed up but have never placed any orders . You are given two tables: customers customer_id (INT) – Unique identifier for each customer customer_name (TEXT) – Name of the customer signup_date (DATE) – Date when the customer signed up orders order_id (INT) – Unique identifier for each order customer_id (INT) – Identifier for the customer who placed the order order_date (DATE) – Date when the order was placed Task: Write a SQL query to return all customers who do not have any orders . Expected Output: customer_id customer_name
Table Setup (SQL Schema)
-- DDL: Create tables
CREATE TABLE customers (
customer_id INT PRIMARY KEY,
customer_name TEXT,
signup_date DATE
);
CREATE TABLE orders (
order_id INT PRIMARY KEY,
customer_id INT,
order_date DATE
);
-- DML: Insert sample data
INSERT INTO customers (customer_id, customer_name, signup_date) VALUES
(1, 'Alice', '2024-01-01'),
(2, 'Bob', '2024-01-05'),
(3, 'Charlie', '2024-01-10'),
(4, 'David', '2024-01-15'),
(5, 'Eve', '2024-01-20'),
(6, 'Frank', '2024-01-25');
INSERT INTO orders (order_id, customer_id, order_date) VALUES
(101, 1, '2024-02-01'),
(102, 2, '2024-02-02'),
(103, 1, '2024-02-10'),
(104, 3, '2024-02-12'),
(105, 5, '2024-02-15');