TwitAA 2012-02-03 17:55:34
[TwitAA 2012-02-03 17:55:34]
(1)
SELECT * FROM Goods
WHERE color IN('red', 'yellow', 'blue')
AND price BETWEEN 100 AND 300
(2)
SELECT * FROM Goods
WHERE NOT color IS NULL AND NOT color="" AND price>100
(3)
SELECT sname, sum(qty) FROM Supplier su, Stock st
WHERE su.sno=st.sno
GROUP BY su.sno
HAVING sum(qty)>=5
(4)
SELECT g.gno, gname, sum(qty) FROM Goods g, Stock s
WHERE g.gno=s.gno
GROUP BY g.gno
ORDER BY sum(qty) DESC
(5)
SELECT g.gno, gname, sum(qty)*price FROM Goods g, Stock s
WHERE g.gno=s.gno
GROUP BY g.gno
HAVING sum(qyt)*price>=500
ORDER BY sum(qty)*price DESC