Answered step by step
Verified Expert Solution
Link Copied!

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 ( Department_ID INT PRIMARY KEY, Department_Name VARCHAR(100), Department_Head INT);///////////////////////////////////////////CREATE TABLE Professor ( Professor_ID INT PRIMARY KEY, Name VARCHAR(100), Specialization VARCHAR(100));///////////////////////////////////////////CREATE TABLE Subject ( Subject_ID INT PRIMARY KEY, Name VARCHAR(100));///////////////////////////////////////////CREATE TABLE Student ( Student_ID INT PRIMARY KEY, Name VARCHAR(100), Major VARCHAR(100));///////////////////////////////////////////CREATE TABLE Grade ( Grade_ID INT PRIMARY KEY, Grade_Name VARCHAR(10));///////////////////////////////////////////CREATE TABLE Course ( Course_ID INT PRIMARY KEY, Course_Name VARCHAR(100), Credit_Hours INT, Department_ID INT, FOREIGN KEY (Department_ID) REFERENCES Department(Department_ID));///////////////////////////////////////////CREATE TABLE Enrollment ( Enrollment_ID INT PRIMARY KEY, Student_ID INT, Course_ID INT, Enrollment_Date DATE, FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID), FOREIGN KEY (Course_ID) REFERENCES Course(Course_ID));///////////////////////////////////////////CREATE TABLE Transcript ( Transcript_ID INT PRIMARY KEY, Student_ID INT, Course_ID INT, Grade_ID INT, FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID), FOREIGN KEY (Course_ID) REFERENCES Course(Course_ID), FOREIGN KEY (Grade_ID) REFERENCES Grade(Grade_ID));///////////////////////////////////////////CREATE TABLE Teach ( Professor_ID INT, Subject_ID INT, PRIMARY KEY (Professor_ID, Subject_ID), FOREIGN KEY (Professor_ID) REFERENCES Professor(Professor_ID), FOREIGN KEY (Subject_ID) REFERENCES Subject(Subject_ID));///////////////////////////////////////////CREATE TABLE Advises ( Professor_ID INT, Student_ID INT, PRIMARY KEY (Professor_ID, Student_ID), FOREIGN KEY (Professor_ID) REFERENCES Professor(Professor_ID), FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID));///////////////////////////////////////////CREATE TABLE Manages ( Professor_ID INT, Department_ID INT, PRIMARY KEY (Professor_ID, Department_ID), FOREIGN KEY (Professor_ID) REFERENCES Professor(Professor_ID), FOREIGN KEY (Department_ID) REFERENCES Department(Department_ID));///////////////////////////////////////////CREATE TABLE Offers ( Department_ID INT, Course_ID INT, PRIMARY KEY (Department_ID, Course_ID), FOREIGN KEY (Department_ID) REFERENCES Department(Department_ID), FOREIGN KEY (Course_ID) REFERENCES Course(Course_ID));///////////////////////////////////////////CREATE TABLE Enroll ( Student_ID INT, Subject_ID INT, Enrollment_Date DATE, PRIMARY KEY (Student_ID, Subject_ID), FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID), FOREIGN KEY (Subject_ID) REFERENCES Subject(Subject_ID));///////////////////////////////////////////CREATE TABLE Prerequisite ( Course_ID INT, Prerequisite_Course_ID INT, PRIMARY KEY (Course_ID, Prerequisite_Course_ID), FOREIGN KEY (Course_ID) REFERENCES Course(Course_ID), FOREIGN KEY (Prerequisite_Course_ID) REFERENCES Course(Course_ID));///////////////////////////////////////////CREATE TABLE Belongs ( Student_ID INT, Department_ID INT, PRIMARY KEY (Student_ID, Department_ID), FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID), FOREIGN KEY (Department_ID) REFERENCES Department(Department_ID));///////////////////////////////////////////ALTER TABLE DepartmentADD CONSTRAINT FK_Department_Head FOREIGN KEY (Department_Head) REFERENCES Professor(Professor_ID);///////////////////////////////////////////--INSERT--///////////////////////////////////////////INSERT INTO Professor (Professor_ID, Name, Specialization) VALUES (1, 'Mohammed Khalid', 'Medicine'),(2, 'Mattar Ebrahim', 'Astrophysics'),(3, 'Abdullah Nabil', 'Marketing'),(4, 'Ghadeer Mohammed', 'Accounting'),(5, 'Hanan Taqi', 'Cyber Security'),(6, 'Khalil Ebrahim', 'Electrical Engineering'),(7, 'Oliver Fariel', 'Surgery'),(8, 'Usman Ahmed', 'Applied Math'),(9, 'Mohamed Wahed', 'Data Science'),(10, 'Eman Ali', 'Civil Engineering');///////////////////////////////////////////INSERT INTO Department (Department_ID, Department_Name, Department_Head) VALUES (1, 'Business and Law', 3),(2, 'Health Sciences', 7),(3, 'Engineering', 10),(4, 'Science', 2),(5, 'Technology', 5);///////////////////////////////////////////INSERT INTO Subject (Subject_ID, Name) VALUES (1, 'Discrete Math'),(2, 'Operating Systems'),(3, 'Calculus'),(4, 'Physics'),(5, 'Signals and systems'),(6, 'Dynamics'),(7, 'Radio Diagnosis'),(8, 'Anatomy'),(9, 'Marketing'),(10, 'Accounting');////////////////////////////

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago