title: MySQL Error Code 3813: "Column Check Constraint", can't create table
body: <p>I am attempting to create my first database in MySQL and running into a bit of a problem, when attepting to run the following table, I am getting the following error:</p>
  
  <blockquote>
    <p>Error Code 3813: Column check constraint 'section_ck_1' references other column.</p>
  </blockquote>
  
  <p>Here is the table I am trying to write</p>
  
  <pre><code>create table section (
  course_id varchar(8),
  sec_id varchar(8),
  semester varchar(6) check (semester in (`Fall`, `Winter`, `Spring`, `Summer`)),
  year numeric(4,0) check (year &gt; 1701 and year &lt; 2100),
  building varchar(15),
  room_number varchar(7),
  time_slot_id varchar(4),
  primary key (course_id, sec_id, semester, year),
  foreign key(course_id) references course(course_id) on delete cascade,
  foreign key (building, room_number) references classroom on delete set null);
  </code></pre>
  
  <p>I believe it is something incorrect with my 'semester' or 'year' rows, although I am not sure what the problem is, or how I would go about fixing it.</p>