AAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
parent
4fb4cff722
commit
4df9bf0aca
33
SQL Hell pt3.txt
Normal file
33
SQL Hell pt3.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* list suppliers who have QTYs greater than the the QTYs of s4 */
|
||||||
|
select snumber, qty
|
||||||
|
from spj
|
||||||
|
where qty > ALL
|
||||||
|
(select qty
|
||||||
|
from spj
|
||||||
|
where snumber = 's4');
|
||||||
|
|
||||||
|
|
||||||
|
/*List suppliers who have qty smaller than any qty of s2*/
|
||||||
|
|
||||||
|
SELECT snumber, qty
|
||||||
|
FROM spj
|
||||||
|
WHERE qty < ANY(SELECT qty FROM spj WHERE snumber = "s2");
|
||||||
|
|
||||||
|
/*List the snumber and QTYs of the supplier who relates with the snumber to the QTYs that are greater than the AVG QTYs of the particular supplier.
|
||||||
|
i.e. for s1 the AVG of all its QTY is x... You must list all the QTYs of s1 that are greater than x.
|
||||||
|
*/
|
||||||
|
select snumber, qty
|
||||||
|
from spj as a
|
||||||
|
where qty >
|
||||||
|
(select avg(qty)
|
||||||
|
from spj
|
||||||
|
where a.snumber = snumber);
|
||||||
|
|
||||||
|
|
||||||
|
/* EXISTS demo */
|
||||||
|
|
||||||
|
select *
|
||||||
|
from supplier a
|
||||||
|
where not EXISTS
|
||||||
|
(select * from spj
|
||||||
|
where snumber = a.snumber);
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
lamp/mysql/03046387ad9d.pid
Normal file
1
lamp/mysql/03046387ad9d.pid
Normal file
@ -0,0 +1 @@
|
|||||||
|
176
|
0
lamp/mysql/3b7ff37a44ba.pid
Normal file → Executable file
0
lamp/mysql/3b7ff37a44ba.pid
Normal file → Executable file
BIN
lamp/mysql/binlog.000033
Normal file → Executable file
BIN
lamp/mysql/binlog.000033
Normal file → Executable file
Binary file not shown.
BIN
lamp/mysql/binlog.000034
Normal file
BIN
lamp/mysql/binlog.000034
Normal file
Binary file not shown.
@ -30,3 +30,4 @@
|
|||||||
./binlog.000031
|
./binlog.000031
|
||||||
./binlog.000032
|
./binlog.000032
|
||||||
./binlog.000033
|
./binlog.000033
|
||||||
|
./binlog.000034
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user