how would i turn this erd into a code for example it should look something like the second photo and first one is the erd

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

how would i turn this erd into a code for example it should look something like the second photo and first one is the erd 

Fee
Exam
PK Fee_ID
Grade
Students
PK
Exam ID
Takes
%23
Fee_AMT
PK Student ID
PK Student_ID
taken
Exam_Name
Fee_Course_ID
PK Exam Name
by
For
Student_FN
Exam_Date
Fee_Type
Student_LN
Student_Grade
Due_Date
Exam_Type
Student_SSN
Late Fee
FK
Course_ID
Student_ADD
Total_Fee
Belongs to
Student_Contact
%3
Student_Email
Enrolls
for
Enrolls
Has
Student Course
Charges
%23
%23
Instructors
PK, FK1 Student_ID
Courses
PK Instructor_ID
Has
PK,FK2 Course_ID
PK Course_ID
Teaches
Instructor_Name
Enrollment_Date
Course_Name
Taught By
FK Instructor_Course
Transcribed Image Text:Fee Exam PK Fee_ID Grade Students PK Exam ID Takes %23 Fee_AMT PK Student ID PK Student_ID taken Exam_Name Fee_Course_ID PK Exam Name by For Student_FN Exam_Date Fee_Type Student_LN Student_Grade Due_Date Exam_Type Student_SSN Late Fee FK Course_ID Student_ADD Total_Fee Belongs to Student_Contact %3 Student_Email Enrolls for Enrolls Has Student Course Charges %23 %23 Instructors PK, FK1 Student_ID Courses PK Instructor_ID Has PK,FK2 Course_ID PK Course_ID Teaches Instructor_Name Enrollment_Date Course_Name Taught By FK Instructor_Course
-drop tables, remove constraints
DROP TABLE KG_Materials CASCADE CONSTRAINTS;
DROP TABLE KG_Fine_Rate CASCADE CONSTRAINTS;
DROP TABLE KG_Material_Subject CASCADE CONSTRAINTS;
DROP TABLE KG_Transactions CASCADE CONSTRAINTS;
DROP TABLE KG_Subject CASCADE CONSTRAINTS;
DROP TABLE KG_Service_Area CASCADE CONSTRAINTS;
DROP TABLE KG_Customer CASCADE CONSTRAINTS;
DROP TABLE KG_Reminders CASCADE CONSTRAINTS;
--create table statements
CREATE TABLE KG_Materials(
Material_ID NUMBER,
Material_Type VARCHAR2 (10),
Location VARCHAR2 (15),
Title VARCHAR2 (45),
Author1_FirstName VARCHAR2 (15),
Author1_LastName VARCHAR2 (15),
Author2_FirstName VARCHAR2 (15),
Author2_LastName VARCHAR2 (15),
Series_Title VARCHAR2 (30),
Cover_Type VARCHAR2 (15),
Material_Value NUMBER);
CREATE TABLE KG_Fine_Rate(
Material_Type VARCHAR2 (10),
Fine_Rate NUMBER);
CREATE TABLE KG_Material_Subject(
Material_ID NUMBER,
Subject_ID NUMBER);
CREATE TABLE KG_Transactions (
Transaction_ID NUMBER,
Customer_ID NUMBER,
Material_ID NUMBER,
Transaction_Date DATE,
Due_Date DATE,
Renewals NUMBER,
Days_Overdue NUMBER,
Return_Date DATE,
Total_Fine NUMBER,
Fine_Status VARCHAR2 (15));
CREATE TABLE KG_Subject(
Subject_ID NUMBER,
Subject_Description VARCHAR2 (15));
CREATE TABLE KG_Customer(
Customer_ID NUMBER,
Customer_FirstName VARCHAR2 (15),
Customer_LastName VARCHAR2 (15),
Customer_Address VARCHAR2 (45),
Customer_City VARCHAR2 (15),
Customer_Zip NUMBER,
Transcribed Image Text:-drop tables, remove constraints DROP TABLE KG_Materials CASCADE CONSTRAINTS; DROP TABLE KG_Fine_Rate CASCADE CONSTRAINTS; DROP TABLE KG_Material_Subject CASCADE CONSTRAINTS; DROP TABLE KG_Transactions CASCADE CONSTRAINTS; DROP TABLE KG_Subject CASCADE CONSTRAINTS; DROP TABLE KG_Service_Area CASCADE CONSTRAINTS; DROP TABLE KG_Customer CASCADE CONSTRAINTS; DROP TABLE KG_Reminders CASCADE CONSTRAINTS; --create table statements CREATE TABLE KG_Materials( Material_ID NUMBER, Material_Type VARCHAR2 (10), Location VARCHAR2 (15), Title VARCHAR2 (45), Author1_FirstName VARCHAR2 (15), Author1_LastName VARCHAR2 (15), Author2_FirstName VARCHAR2 (15), Author2_LastName VARCHAR2 (15), Series_Title VARCHAR2 (30), Cover_Type VARCHAR2 (15), Material_Value NUMBER); CREATE TABLE KG_Fine_Rate( Material_Type VARCHAR2 (10), Fine_Rate NUMBER); CREATE TABLE KG_Material_Subject( Material_ID NUMBER, Subject_ID NUMBER); CREATE TABLE KG_Transactions ( Transaction_ID NUMBER, Customer_ID NUMBER, Material_ID NUMBER, Transaction_Date DATE, Due_Date DATE, Renewals NUMBER, Days_Overdue NUMBER, Return_Date DATE, Total_Fine NUMBER, Fine_Status VARCHAR2 (15)); CREATE TABLE KG_Subject( Subject_ID NUMBER, Subject_Description VARCHAR2 (15)); CREATE TABLE KG_Customer( Customer_ID NUMBER, Customer_FirstName VARCHAR2 (15), Customer_LastName VARCHAR2 (15), Customer_Address VARCHAR2 (45), Customer_City VARCHAR2 (15), Customer_Zip NUMBER,
Expert Solution
Step 1: SQL code

CREATE TABLE Students(Student_ID INT NOT NULL, Student_FN VARCHAR(15), Student_LN VARCHAR(15), Student_SSN INT, Student_ADD VARCHAR(45), Student_Contact int, Student_Email VARCHAR(30), PRIMARY KEY (Student_ID));

CREATE TABLE Grade(Student_ID INT, Exam_Name VARCHAR(15) NOT NULL, Student_Grade VARCHAR(5), PRIMARY KEY(Exam_Name),FOREIGN KEY(Student_ID) REFERENCES Students(Student_ID));

CREATE TABLE Courses(Course_ID INT NOT NULL, Course_Name VARCHAR(15), PRIMARY KEY(Course_ID));

CREATE TABLE Exam(Exam_ID INT NOT NULL, Exam_Name VARCHAR(15), Exam_Date DATE, Exam_Type VARCHAR(15), Course_ID INT, PRIMARY KEY(Exam_ID), FOREIGN KEY(Course_ID) REFERENCES Courses(Course_ID));

CREATE TABLE Student_Course(Student_ID INT, Course_ID INT,Enrollment_Date DATE, PRIMARY KEY(Course_ID), FOREIGN KEY(Student_ID) REFERENCES Students(Student_ID), FOREIGN KEY(Course_ID) REFERENCES Courses(Course_ID));

CREATE TABLE Fee( Fee_ID INT NOT NULL, Fee_AMT INT, Fee_Course_ID INT, Fee_Type VARCHAR(20), Due_Date DATE, Late_Fee INT, Total_Fee INT, PRIMARY KEY(Fee_ID));

CREATE TABLE Instructors(Instructor_ID INT NOT NULL, Instructor_Name VARCHAR(20), Instructor_Course VARCHAR(30), PRIMARY KEY(Instructor_ID));

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Database connectivity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education