Company: Swiggy
Difficulty: medium
Problem Description Write a SQL query to generate a unified list of all customers who do not have any associated invoices, and all products that have never been sold (i.e., do not appear on any invoice). You must combine both sets of records into a single result set using the UNION (or UNION ALL ) operator. Schema customer Table Column Name Type Description customer_id INT Primary key for the customer. customer_name VARCHAR Name of the customer. product Table Column Name Type Description product_id INT Primary key for the product. product_name VARCHAR Name of the product. invoice Table Column Name Type Description invoice_id INT Primary key for the invoice. customer_id INT Foreign key referencing customer.customer_id . product_id INT Foreign key referencing product.product_id . Required Output Return exactly three columns in the following order: entity_type : The literal string 'customer' for customers, or 'product' for products. id : The customer_id or product_id . name : The customer