'sid'が主キーである'students'テーブルを作成し、sidに多くの値を挿入しました。'courses'という2番目のテーブルを作成し、主キー'cid'を持っています。cidの値も入力しました。ここで、「enroll」というリレーションテーブルを作成します。
create table enroll(
grade char(2),
sid int not null,
cid int not null,
primary key(sid,cid),
foreign key (cid) references courses(cid) on delete cascade,
foreign key (sid) references students(sid) on delete cascade
);
さて、を使用してテーブルを表示しようとすると、select * from enroll;
出力が得られません。「0行が返されました」と表示されます。どうしてこれなの?他のテーブルのsidとcidのすべての値を持っているはずではありませんか?