SHARE
TWEET

Untitled

a guest Aug 14th, 2012 28 Never
  1. CREATE TABLE students (
  2.   id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  3.   username VARCHAR(64) NOT NULL,
  4.   password VARCHAR(64),
  5.   email VARCHAR(...)
  6.   UNIQUE KEY (username)
  7. );
  8.  
  9. CREATE TABLE courses (
  10.   id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  11.   name VARCHAR(64) NOT NULL
  12. );
  13.  
  14. CREATE TABLE enrollments (
  15.   id INT NOT NULL PRIMARY KEY,
  16.   student_id INT NOT NULL,
  17.   course_id INT NOT NULL,
  18.   UNIQUE KEY (student_id, course_id),
  19.   FOREIGN KEY (student_id) REFERENCES students (id),
  20.   FOREIGN KEY (course_id) REFERENCES courses (id)
  21. );
  22.  
  23. CREATE TABLE assignments (
  24.   id INT NOT NULL PRIMARY KEY,
  25.   course_id INT NOT NULL,
  26.   title VARCHAR(64)
  27.   description VARCHAR(64)
  28. );
RAW Paste Data
Top