FOREIGN KEY MULTI FIELD HELP! -
i have 2 table
table class ( school varchar(50), year varchar(50), grade varchar(50), classname varchar(50), primary key (school,year,grade,classname) ) table student ( student_id varchar(50) primary key, detail varchar(50) )
now, want subclass students. how create reference?
just else does...
create table class ( id int not null auto_increment primary key, -- create key column school varchar(50), year varchar(50), grade varchar(50), classname varchar(50), unique (school,year,grade,classname) ); create table student ( student_id varchar(50) primary key, class_id int references class, -- reference key detail varchar(50) );
Comments
Post a Comment