联合主键就是表中2个或者2个以上的字段做为这个表的主键,通常多对多的关系表中使用联合主键.例如有表学生,表课程,另外一个表选课,选课表用来记录每个学生所选的课程,这个选课表就可以用联合主键.
create table test(id int,addDate datetime,其它字段,primary key(id,addDate));
点中一个后,按下ctrl,然后选中另外一个,就可以设置为联合主键了
create table test(id int,addDate datetime,其它字段,primary key(id,addDate));
点中一个后,按下ctrl,然后选中另外一个,就可以设置为联合主键了