Hi,
Considering the query, I created two tables, one based on payments and the other on customers, and used inner join to join two tables based on customer number and then fetched the amount column, which is null from payments.
Any payment not made is empty/null there; you can try this query.
SELECT c.customer_number AS id, c.customer_name as name, c.phone,
p.amount as payment from customerss c
INNER JOIN payments p ON c.customer_number = p.customer_number
where p.amount is null;
Based on this, you can initially select any columns to your need and point out to the non-paid customers where the column is null.
Complex Subqueries
Description: Given a table named customers and a table named payments with the following columns.
Payments:
customerNumber, checkNumber, paymentDate , amount
Customers:
customerNumber, customerName, contactLastName, contactFirstName, phone, addressLine1, addressLine2, city, state, postalCode, country, salesRepEmployeeNumber, creditLimit
Write a query to find all customers who have not made any payments.