Use SQL DDL to specify the schema in MySQL of the Student Re
Use SQL DDL to specify the schema in MySQL of the Student Registration Systemfragment shown below:
Student (Id: INTEGER, Name: STRING, Address: STRING, Status: STRING)Key : {Id}
Professor (Id: INTEGER, Name: STRING, DeptId: STRING)Key: {Id}
Course (DeptId: STRING, CrsCode: STRING, CrsName: STRING, Descr: STRING)
Keys: {CrsCode}, {DeptId, CrsName}
Transcript (StudId: Integer, CrsCode: STRING, Semester: STRING Grade: STRING)
Key: {StudId, CrsCode, Semester}
Teaching (ProfId: INTEGER, CrsCode: STRING, Semester: STRING)
Key: {crsCode, Semester}
Be sure to include the following foreign key constraints in your schema definition:
Transcript(StudId) references Student(Id)
Transcript(CrsCode) references Course(CrsCode)
Teaching(ProfId) references Professor(Id)
Teaching(CrsCode) references Course(CrsCode)
Transcript(CrsCode, Semester) references Teaching(CrsCode, Semester)
Solution
create table Student(id int,name varchar(20),Address varchar(20),status varchar(20),primary key(id));
create table Professor(pid int,name varchar(20),deptid varchar(20),primary key(pid));
create table transcript(semester varchar(20),grade varchare(20),id int references Student(studid),crscode varchar(20)references couserse(crscode),semister references teaching(semsister));
create table teaching(semester varchar(20) ,pid int references proffesor(pid),crscode varchar(20)references couserse(crscode),primary key(semister));
create table Course(deptid varchar(20),crscode varchar(20) not null,crsname varchar(20),descr varchar(20),primary key(deptid,crsname,crscode));
