create table s
(sno char(4) primary key,
sname char(20),
status char(4),
city char(20)
)
create table p
(pno char(4) primary key,
pname char(20),
color char(6),
weight smallint
)
create table j
(jno char(4) primary key,
jname char(20),
city char(20)
)
create table spj
(sno char(4) references s(sno),
pno char(4) references p(pno),
jno char(4) references j(jno),
qty smallint,
primary key(sno,pno,jno)
)
/*
create table spj
(sno char(4),
pno char(4),
jno char(4),
qty smallint,
primary key(sno,pno,jno),
foreign key (sno) references s(sno),
foreign key (pno) references p(pno),
foreign key (jno) references j(jno)
)
*/
select distinct sno
from spj
where jno='j1'
select distinct sno
from spj
where jno='j1'and pno='p1'
SPJデータベース-最初にSQLステートメントに精通している(2)
おすすめ
転載: blog.csdn.net/qq_46139801/article/details/115252210
おすすめ
ランキング