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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -