title: Use Composite Primary Key as Foreign Key
body: <p>How can I use a composite primary key as a foreign key? It looks like my attempt does not work.</p>
  
  <pre><code>create table student
  (
  student_id varchar (25) not null ,
  student_name varchar (50) not null ,
  student_pone int ,
  student_CNIC varchar (50),
  students_Email varchar (50),
  srudents_address varchar(250),
  dept_id varchar(6),
  batch_id varchar(4),
  FOREIGN KEY (dept_id) REFERENCES department(dept_id),
  FOREIGN KEY (batch_id) REFERENCES batch(batch_id),
  CONSTRAINT pk_studentID PRIMARY KEY (batch_id,dept_id,student_id) )
  </code></pre>
  
  <hr>
  
  <pre><code>create table files
  (
  files_name varchar(50) not null ,
  files_path varchar(50),
  files_data varchar(max),
  files_bookmarks xml ,
  FOREIGN KEY (pk_studentID ) REFERENCES student(pk_studentID ),
  CONSTRAINT pk_filesName PRIMARY KEY (files_name) )
  </code></pre>