AAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
parent
f386902358
commit
4fb4cff722
41
Semester 2/SQL Hell pt 2.txt
Normal file
41
Semester 2/SQL Hell pt 2.txt
Normal file
@ -0,0 +1,41 @@
|
||||
/* 1. list the snumber, sname, and pnumber for suppliers who supply parts but the condition of the joins is in the where clause */
|
||||
select supplier.snumber, sname, pnumber, jnumber
|
||||
from supplier, spj
|
||||
where spj.snumber = supplier.snumber
|
||||
|
||||
/* 2. list the snumber, sname, and pnumber for suppliers USING SUBQUERIES aka nested selects */
|
||||
select snumber, (select a.sname from supplier as a where a.snumber = spj.snumber)
|
||||
pnumber, jnumber
|
||||
from spj
|
||||
where spj.snumber in
|
||||
(select supplier.snumber from supplier);
|
||||
|
||||
/* 3. list the snumber, sname, and pnumber for suppliers USING SUBQUERIES aka nested selects */
|
||||
select snumber, (select a.sname from supplier as a
|
||||
where a.snumber = spj.snumber)
|
||||
(select b.jname from project as b
|
||||
where b.jnumber = spj.jnumber),
|
||||
pnumber, jnumber
|
||||
from spj
|
||||
where spj.snumber in
|
||||
(select supplier.snumber
|
||||
from supplier);
|
||||
|
||||
|
||||
/*4. List the snumber, sname, pnumber, jnumber and jname for suppliers who supply parts but not the condition for all joins in there WHERE clause */
|
||||
|
||||
select supplier.snumber, sname, spj.jnumber, jname
|
||||
from supplier, spj, project
|
||||
where supplier.snumber = spj.snumber AND
|
||||
spj.jnumber = project.jnumber;
|
||||
|
||||
|
||||
select * /* for i 0 to number of suppliers */
|
||||
from supplier
|
||||
where snumber in
|
||||
(select snumber /* for j 0 to number of tuples in spj */
|
||||
from spj
|
||||
where jnumber IN
|
||||
(select jnumber /* for K 0 to number of tuples in project */
|
||||
from project)
|
||||
);
|
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/2763f9de9157.pid
Normal file → Executable file
0
lamp/mysql/2763f9de9157.pid
Normal file → Executable file
1
lamp/mysql/3b7ff37a44ba.pid
Normal file
1
lamp/mysql/3b7ff37a44ba.pid
Normal file
@ -0,0 +1 @@
|
||||
172
|
BIN
lamp/mysql/binlog.000032
Normal file → Executable file
BIN
lamp/mysql/binlog.000032
Normal file → Executable file
Binary file not shown.
BIN
lamp/mysql/binlog.000033
Normal file
BIN
lamp/mysql/binlog.000033
Normal file
Binary file not shown.
@ -29,3 +29,4 @@
|
||||
./binlog.000030
|
||||
./binlog.000031
|
||||
./binlog.000032
|
||||
./binlog.000033
|
||||
|
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.
Loading…
Reference in New Issue
Block a user