Continue this part on your database at home please Study the ERD below and write
ID: 3883293 • Letter: C
Question
Continue this part on your database at home please
Study the ERD below and write SQL DDL commands to create the DEPARTMENTS, PROFESSORS, CLASSES, STUDENTS, PROFESSORS_CLASSES and STUDENT_CLASSES tables. Use the most appropriate datatype you think will suite each column.
Good Luck, work hard, Practice, Practice, Practice!
Study the ERD below and write SQL DDL commands to create the DEPARTMENTS, PROFESSORS, CLASSES, STUDENTS, PROFESSORS_CLASSES and STUDENT_CLASSES tables. Use the most appropriate datatype you think will suite each column.
Good Luck, work hard, Practice, Practice, Practice!
Explanation / Answer
Here are the SQL DDL commands
CREATE TABLE `DEPARTMENTS` ( `code` INT NOT NULL , `name` VARCHAR(50) NOT NULL , `college` VARCHAR(50) NOT NULL , PRIMARY KEY (`code`));
CREATE TABLE `PROFESSORS` ( `ssn` INT NOT NULL , `first_name` VARCHAR(50) NOT NULL , `middle_name` VARCHAR(50) NOT NULL ,`last_name` VARCHAR(50) NOT NULL , `position` VARCHAR(50) NOT NULL ,`department` INT NOT NULL , PRIMARY KEY (`ssn`));
CREATE TABLE `CLASSES` ( `class_code` INT NOT NULL , `name` VARCHAR(50) NOT NULL , `credits` VARCHAR(50) NOT NULL , `department` INT NOT NULL , PRIMARY KEY (`class_code`), UNIQUE (`department`));
CREATE TABLE `STUDENTS` ( `ssn` INT NOT NULL , `first_name` VARCHAR(50) NOT NULL , `middle_name` VARCHAR(50) NOT NULL ,`last_name` VARCHAR(50) NOT NULL ,`major` INT NOT NULL , PRIMARY KEY (`ssn`), UNIQUE (`major`));
CREATE TABLE `PROFESSORS_CLASSES` ( `professor` INT NOT NULL , `class` INT NOT NULL , `cemester` VARCHAR(50) NOT NULL , UNIQUE (`professor`), UNIQUE (`class`));
CREATE TABLE `STUDENT_CLASSES` ( `student` INT NOT NULL , `class` INT NOT NULL , `cemester` VARCHAR(50) NOT NULL , `grade` VARCHAR(5) NOT NULL , UNIQUE (`student`), UNIQUE (`class`));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.