Q: Name of customers along with their Ids who have placed order of amount more than 10000 to the company?
Ans: Here is an example of a SQL query that can be used to retrieve the names of customers along with their IDs who have placed an order of amount more than 10000 to the company:
SELECT c.customer_id, c.name
FROM customers c
JOIN orders o
ON c.customer_id = o.customer_id
WHERE o.total_amount > 10000;
This query retrieves customer_id and name columns from the customers table and join it with the orders table using customer_id. Then it filters the results where the total_amount in the orders table is greater than 10000.
This query assumes that there are two tables: "customers" which contains columns customer_id, name and "orders" which contains columns customer_id, total_amount.
Please keep in mind that table names, column names and the actual query may vary depending on the database structure and naming conventions used.
No comments:
Post a Comment