title: Oracle SQL Developer - Adding Constraints on Foreign Key
body: <p>I'm new to Oracle SQL and I am having a hard time adding a constraint. I am trying to add constraints on my table to enforce specific business rules that only allows students only to take 4 courses and a max of 25 students per class. </p>
  
  <p>Please let me know what additional information you need from me to help answer this question. I am at a loss...</p>
  
  <pre><code>CREATE TABLE GRADES
  (STU_ID       int NOT NULL ENABLE,
   CRSE_ID        CHAR(9) NOT NULL ENABLE,
   STU_CRSE_GRADE VARCHAR2(20) 
   check(STU_CRSE_GRADE='A' or 
         STU_CRSE_GRADE='B' or 
         STU_CRSE_GRADE='C' or 
         STU_CRSE_GRADE ='D' or 
         STU_CRSE_GRADE= 'F'),
   CONSTRAINT GRADES_PK PRIMARY KEY (STU_ID, CRSE_ID),
   constraint fk_Grades Foreign key(Stu_ID)
     REFERENCES Students,
   constraint fk_Grades_Crse_ID foreign key(Crse_ID)
     REFERENCES Courses
  );
  </code></pre>
  
  <p>No problem! See tables below:</p>
  
  <pre><code>CREATE TABLE Students
  (Stu_ID int Constraint pk_Stu_ID Primary Key,
  Stu_name VARCHAR(255) NOT NULL, Stu_Add varchar(255),
  Stu_Maj CHAR(6)
  );
  
  CREATE TABLE Instructors
  (Instr_ID char(3) Constraint pk_Instr_ID Primary Key,
  Instr_Name VARCHAR(255) NOT NULL, Instr_Office varchar(8)
  );
  
  CREATE TABLE Courses
  (Crse_ID char(9) Constraint pk_Crse_ID Primary Key,
  Crse_Title VARCHAR(255) NOT NULL,
  Student’s name: Lai Xia
  Instr_ID CHAR(3) not null,
  constraint fk_Courses_Instr_ID Foreign key(Instr_ID) REFERENCES Instructors
  );
  </code></pre>