add constraint PK_CLA_NUM check (Number>1 and Number<100) 3) ÉèÖÃMonitorΪÍâÂë
½¨Á¢FOREIGN KEYÔ¼Êø£¬sqlÓï¾äΪ¡£ alter table Class
add constraint PK_CLA_MON
foreign key (Monitor) references Student (Sno) 4. Ϊ³É¼¨Grade ±í½¨Á¢ÍêÕûÐÔÔ¼Êø 1) ÉèÖÃSnoºÍCnoΪÖ÷ÊôÐÔ¡¢Íâ¼ü¡£
½¨Á¢FOREIGN KEYÔ¼Êø£¬ÉèÖÃSnoºÍCnoΪÍâÂësqlÓï¾äΪ¡£ alter table Grade
add constraint PK_GRA_SNO
foreign key (Sno) references Student (Sno) alter table Grade
add constraint PK_GRA_CNO
foreign key (Cno) references Cource(Cno) ÉèÖÃSno,CnoΪÖ÷Âë
½¨Á¢PRIMARY KEYÔ¼ÊøµÄSqlÓï¾äΪ£º
alter table Grade add constraint PK_GRA_PRI primary key (Sno,Cno) 2) ÉèÖÃGmarkΪ´óÓÚ1СÓÚ100¡£ ½¨Á¢CHECKÔ¼Êø.sqlÓï¾äΪ
µÚ 49 Ò³ ¹² 50 Ò³
alter table Grade
add constraint PK_GRA_GMA check (Gmark>1 and Gmark<100)
µÚ 50 Ò³ ¹² 50 Ò³