List all customers who bought copy paper but did not buy any other item.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)
(select customer.customer_name from customer, order_details, orders, office_supplies where customer.customer_id = orders.customer_id, orders.order_id = order_details.order_id, office_supplies.item_id = order_details.item_id and office_supplies.item_name = "copy paper" )
MINUS
(select customer.customer_name from customer, order_details, orders, office_supplies where customer.customer_id = orders.customer_id, orders.order_id = order_details.order_id, office_supplies.item_id = order_details.item_id and office_supplies.item_name != "copy paper" )
We are taking the difference of these two output where first output is customer name who ordered copy paper and second one is customer name who order anything other than copy paper , which will be out desired result
Please comment for any clarification
List all customers who bought copy paper but did not buy any other item.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,st...
List the names of the customer (or customers) who spent the greatest dollar amount in a single order.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)
List the names of all customers who bought both envelopes and labels (either in the same order or different orders).please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)
List all items sold by the company, sorted alphabetically by category and the alphabetically by item name. please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)
List each category, the name of the customer who has spent the most on items in that category, and the total amount of money that customer spent in that category.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)