SELECT customername FROM customer c, mobile m, purchase p WHERE p.mobileidm.mobileid AND c.customerid = p.customerid AND p.customerid IN (SELECT customerid FROM purchase GROUP BY customerid HAVING #SPACE1=(SELECT #SPACE2 FROM purchase GROUP BY customerid)) AND price> 40000;
8
9
11
What should be written at #SPACE1 and #SPACE2 respectively in the query given above to get John, Jack and Maria in the output?
SELECT customer_id,MAX(purch_amt)
FROM orders
WHERE customer_id BETWEEN 3002 and 3007
GROUP BY customer_id
HAVING MAX(purch_amt)>1000;
Comments
Leave a comment