Question: Use MySQL server. First step: create and use database called EDU. Syntax: CREATE SCHEMA edu; USE edu; Create a script which will create the tables
Use MySQL server. First step: create and use database called EDU. Syntax: CREATE SCHEMA edu; USE edu;
Create a script which will create the tables listed below: STUDENT(STUDENT_ID, STUDENT_NAME, MAJOR_ID, DOB, PHONE_NUMBER) MAJOR(MAJOR_ID, MAJOR_NAME) ENROLLMENT(STUDENT_ID, COURSE_ID, GRADE) COURSE(COURSE_ID, COURSE_NAME) RESPONSIBILITY(FACULTY_ID, COURSE_ID) TEACHER(FACULTY_ID, DEPT_ID, TEACHER_NAME) DEPARTMENT(DEPT_ID, DEPARTMENT_NAME)
Start the script with a series of DROP statements so that as you correct mistakes you will start fresh each time. To avoid referential integrity errors, the table drops should be in the opposite order of the create table statements.
Put script name and your name in the script heading see example: Example of a script: /*script1.sql Student Name: ------*/ USE sh; DROP TABLE IF EXISTS part; DROP TABLE IF EXISTS salesrep; CREATE TABLE part (Partno CHAR(4) PRIMARY KEY, Partdesc VARCHAR(20), Onhand INTEGER, Partclass CHAR(2) check (Partclass IN ('AP','HW','KI','SP')), Unitprice DECIMAL(6,2) ); CREATE TABLE salesrep (Srepno CHAR(3), Srepname VARCHAR(25), Srepstreet VARCHAR(30), Srepcity VARCHAR(15) NOT NULL, Srepprov VARCHAR(3) NOT NULL, Sreppcode VARCHAR(6) NOT NULL, Totcomm DECIMAL(8,2), Commrate DECIMAL(3,2), CONSTRAINT pkslsrep PRIMARY KEY (Srepno) );
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
