Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make relational schema or mapping for the followingCREATE DATABASE myDB; / / / / / / / / / / / / / / /
Make relational schema or mapping for the followingCREATE DATABASE myDB; USE myDB;CREATE TABLE Department DepartmentID INT PRIMARY KEY, DepartmentName VARCHAR DepartmentHead INT;CREATE TABLE Professor ProfessorID INT PRIMARY KEY, Name VARCHAR Specialization VARCHAR;CREATE TABLE Subject SubjectID INT PRIMARY KEY, Name VARCHAR;CREATE TABLE Student StudentID INT PRIMARY KEY, Name VARCHAR Major VARCHAR;CREATE TABLE Grade GradeID INT PRIMARY KEY, GradeName VARCHAR;CREATE TABLE Course CourseID INT PRIMARY KEY, CourseName VARCHAR CreditHours INT, DepartmentID INT, FOREIGN KEY DepartmentID REFERENCES DepartmentDepartmentID;CREATE TABLE Enrollment EnrollmentID INT PRIMARY KEY, StudentID INT, CourseID INT, EnrollmentDate DATE, FOREIGN KEY StudentID REFERENCES StudentStudentID FOREIGN KEY CourseID REFERENCES CourseCourseID;CREATE TABLE Transcript TranscriptID INT PRIMARY KEY, StudentID INT, CourseID INT, GradeID INT, FOREIGN KEY StudentID REFERENCES StudentStudentID FOREIGN KEY CourseID REFERENCES CourseCourseID FOREIGN KEY GradeID REFERENCES GradeGradeID;CREATE TABLE Teach ProfessorID INT, SubjectID INT, PRIMARY KEY ProfessorID SubjectID FOREIGN KEY ProfessorID REFERENCES ProfessorProfessorID FOREIGN KEY SubjectID REFERENCES SubjectSubjectID;CREATE TABLE Advises ProfessorID INT, StudentID INT, PRIMARY KEY ProfessorID StudentID FOREIGN KEY ProfessorID REFERENCES ProfessorProfessorID FOREIGN KEY StudentID REFERENCES StudentStudentID;CREATE TABLE Manages ProfessorID INT, DepartmentID INT, PRIMARY KEY ProfessorID DepartmentID FOREIGN KEY ProfessorID REFERENCES ProfessorProfessorID FOREIGN KEY DepartmentID REFERENCES DepartmentDepartmentID;CREATE TABLE Offers DepartmentID INT, CourseID INT, PRIMARY KEY DepartmentID CourseID FOREIGN KEY DepartmentID REFERENCES DepartmentDepartmentID FOREIGN KEY CourseID REFERENCES CourseCourseID;CREATE TABLE Enroll StudentID INT, SubjectID INT, EnrollmentDate DATE, PRIMARY KEY StudentID SubjectID FOREIGN KEY StudentID REFERENCES StudentStudentID FOREIGN KEY SubjectID REFERENCES SubjectSubjectID;CREATE TABLE Prerequisite CourseID INT, PrerequisiteCourseID INT, PRIMARY KEY CourseID PrerequisiteCourseID FOREIGN KEY CourseID REFERENCES CourseCourseID FOREIGN KEY PrerequisiteCourseID REFERENCES CourseCourseID;CREATE TABLE Belongs StudentID INT, DepartmentID INT, PRIMARY KEY StudentID DepartmentID FOREIGN KEY StudentID REFERENCES StudentStudentID FOREIGN KEY DepartmentID REFERENCES DepartmentDepartmentID;ALTER TABLE DepartmentADD CONSTRAINT FKDepartmentHead FOREIGN KEY DepartmentHead REFERENCES ProfessorProfessorID;INSERTINSERT INTO Professor ProfessorID Name, Specialization VALUES 'Mohammed Khalid', 'Medicine' 'Mattar Ebrahim', 'Astrophysics' 'Abdullah Nabil', 'Marketing' 'Ghadeer Mohammed', 'Accounting' 'Hanan Taqi', 'Cyber Security' 'Khalil Ebrahim', 'Electrical Engineering' 'Oliver Fariel', 'Surgery' 'Usman Ahmed', 'Applied Math' 'Mohamed Wahed', 'Data Science' 'Eman Ali', 'Civil Engineering';INSERT INTO Department DepartmentID DepartmentName, DepartmentHead VALUES 'Business and Law', 'Health Sciences', 'Engineering', 'Science', 'Technology', ;INSERT INTO Subject SubjectID Name VALUES 'Discrete Math' 'Operating Systems' 'Calculus' 'Physics' 'Signals and systems' 'Dynamics' 'Radio Diagnosis' 'Anatomy' 'Marketing' 'Accounting';
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started