waiting for mySQL to die
This commit is contained in:
parent
e388e94516
commit
f515bb2bd7
21
Semester 2/SQL Hell
Normal file
21
Semester 2/SQL Hell
Normal file
@ -0,0 +1,21 @@
|
||||
/* select the snumbers and the number of parts suppled and the average qty of parts supplied for those suppliers who have a qty greater than the average qty of all suppliers. */
|
||||
select avg(qty)
|
||||
from spj
|
||||
group by snumber;
|
||||
|
||||
#/ average of parts supplied */
|
||||
select avg(qty)
|
||||
from spj;
|
||||
|
||||
/* select the snumbers and the number of parts suppled and the average qty of parts supplied for those suppliers who have a qty greater than the average qty of all suppliers. */
|
||||
select snumber, avg(qty)
|
||||
from spj
|
||||
group by snumber
|
||||
having avg(qty) > (
|
||||
|
||||
(select avg(qty) from spj));
|
||||
|
||||
|
||||
|
||||
|
||||
/* select number and the avg qty for suppliers whos range is greater tham the sum of all qty */
|
49
Semester 2/SQL Hell.txt
Normal file
49
Semester 2/SQL Hell.txt
Normal file
@ -0,0 +1,49 @@
|
||||
/* select the snumbers and the number of parts suppled and the average qty of parts supplied for those suppliers who have a qty greater than the average qty of all suppliers. */
|
||||
select avg(qty)
|
||||
from spj
|
||||
group by snumber;
|
||||
|
||||
#/ average of parts supplied */
|
||||
select avg(qty)
|
||||
from spj;
|
||||
|
||||
/* select the snumbers and the number of parts suppled and the average qty of parts supplied for those suppliers who have a qty greater than the average qty of all suppliers. */
|
||||
select snumber, avg(qty)
|
||||
from spj
|
||||
group by snumber
|
||||
having avg(qty) > (
|
||||
|
||||
(select avg(qty) from spj));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* select number and the avg qty for suppliers whose range is greater tham the sum of all qty */
|
||||
select snumber, avg(qty), (select avg(qty) as AVERAGE_QTY_OF_ALL)
|
||||
from spj
|
||||
group by snumber
|
||||
having avg(qty) >
|
||||
(select avg(qty)
|
||||
from spj);
|
||||
|
||||
/* list snumber, snames, and total number of parts supplied for suppliers who live in london, athens or paris, Use nested selects.
|
||||
1. Use WHERE clause only without nested selects.
|
||||
2. Use nested selects .
|
||||
*/
|
||||
|
||||
select supplier.snumber, sname, pnumber, city
|
||||
from supplier, spj
|
||||
where supplier.snumber = spj.snumber and
|
||||
(city = 'paris' or city = 'london');
|
||||
|
||||
select supplier.snumber, sname, count(pnumber) as NUM_PARTS_SUPPLIED
|
||||
from supplier, spj
|
||||
where supplier.snumber = spj.snumber and
|
||||
(city = 'paris' or city = 'london')
|
||||
group by spj.snumber;
|
||||
|
||||
select supplier.snumber, count(pnumber) as NUM_PARTS_SUPPLIED
|
||||
(select sname from supplier where snumber = spj.snumber)
|
||||
(select city from supplier where snumber = spj.snumber)
|
||||
from spj
|
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.
0
lamp/mysql/565094360db9.pid
Normal file → Executable file
0
lamp/mysql/565094360db9.pid
Normal file → Executable file
1
lamp/mysql/87c780094856.pid
Normal file
1
lamp/mysql/87c780094856.pid
Normal file
@ -0,0 +1 @@
|
||||
172
|
BIN
lamp/mysql/binlog.000030
Normal file → Executable file
BIN
lamp/mysql/binlog.000030
Normal file → Executable file
Binary file not shown.
BIN
lamp/mysql/binlog.000031
Normal file
BIN
lamp/mysql/binlog.000031
Normal file
Binary file not shown.
@ -27,3 +27,4 @@
|
||||
./binlog.000028
|
||||
./binlog.000029
|
||||
./binlog.000030
|
||||
./binlog.000031
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
lamp/mysql/tennis_db/matches.ibd
Normal file → Executable file
0
lamp/mysql/tennis_db/matches.ibd
Normal file → Executable file
0
lamp/mysql/tennis_db/players.ibd
Normal file → Executable file
0
lamp/mysql/tennis_db/players.ibd
Normal file → Executable file
0
lamp/mysql/tennis_db/teams.ibd
Normal file → Executable file
0
lamp/mysql/tennis_db/teams.ibd
Normal file → Executable file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user