OMENSAH
3/22/2017 - 9:07 AM

class_project_schema

create table useraccount(
  userid int(11) primary key AUTO_INCREMENT not null, 	
  username	varchar(50) UNIQUE,
  pwd	varchar(100) not null,
  fname	varchar(40) not null,
  name	varchar(40) not null,
  email	varchar(50 )UNIQUE  not null,
  gender varchar(1) not null,
  major_id int(11) not null,
  userstatus	ENUM (ACTIVE,	INACTIVE) not null,
  per_id int(11) not null,
  FOREIGN KEY(major_id)  REFERENCES allmajor(majorid),
  FOREIGN KEY(per_id)  REFERENCES allpermission(perid)
  );
  
  
  create table allmajor(
    majorid	int(11) primary key AUTO_INCREMENT not null,
    majorname	varchar(50) not null
 );
 
 
 create table allcourses(
     courseid int(11) primary key AUTO_INCREMENT not null,
     coursecode	varchar(10) not null,
     coursename	varchar(100) not null,
     courseyear	int(11) not null
  );
  
  
  create table majorcourses(
      majorcourseid	int(11) primary key AUTO_INCREMENT not null,
      major_id	int(11) not null,
      course_id	int(11) not null,
      FOREIGN KEY(major_id)  REFERENCES allmajor(majorid),
      FOREIGN KEY( course_id)  REFERENCES allpermission(courseid)
      );
      
  create table allpermission(
      perid		int(11) primary key AUTO_INCREMENT not null,
      pername	varchar(50) not null
      );
      
   create table usercourses(
       user_id	int(11) not null,	
       majorcourse_id	int(11) not null,
       grade varchar(10) not null,
       FOREIGN KEY(user_id)  REFERENCES useraccount(userid )
      );