IMSE 685 Manufacturing Information Systems Homework Assignment #3
IMSE 685 Manufacturing Information Systems Homework Assignment #3
Homework Assignment #3
Due Date: Tuesday Nov 10th, 2020 11:59pm
Two plus pages written report will be required for this project.
Include all the SQL statements question by question with additional explanations.
This project will be performed with maximal two students.
The project papers will not be handed back.
Please hand in the report with the appropriate answers to the questions. Below each question,
please add the SQL statement (or answer the question) you used to complete the requirements.
(I) Create the schema in IMSE685 database with the following tables (60 points):
STUDENT
Name StudentID Class Major
COURSE
CourseName CourseNo CreditHour DepartmentID
PREREQUISITE
CourseNo PrerequisiteNo
SECTION
SecitonID CourseNo Semester Year Instructor
GRADE_REPORT
StudentID SectionID Grade
(II) Insert 5 records (sample data) for each of the following tables using K-State KSIS format:
Note that the provided sample data only has few entries. You can required to populate data of 5
students/courses.
SQL code to generate data tables and data entery
CREATE TABLE `imse685`.`STUDENT` (
`StudentID` INT(11) NOT NULL,
`Name` VARCHAR(50) NOT NULL,
`Class` VARCHAR(50) NOT NULL,
`Major` VARCHAR(50) NOT NULL,
PRIMARY KEY (`StudentID`)
) ENGINE =MyISAM;
In the data table generated as requested in above (I), there is table STUDENT in which a column
Name exists.
SELECT name
FROM student
ORDER BY name ASC;
SELECT *
FROM student
ORDER BY name ASC;
2. Show grades of students with names of students and course name as well.
SELECT student.name,section.CourseNo,grade_report.Grade
FROM grade_report
INNER JOIN student ON student.StudentID = grade_report.StudentID
INNER JOIN section ON section.SectionID = grade_report.SectionID
ORDER BY name ;
3. Show list of students who has never received a grade below B in any course.
5. One of the courses now has a different prerequisite. Change the prerequisite table
as needed.
If there is required to remove previous previous entery which is not required then we can update
UPDATE prerequisite
SET prequisiteNo = ‘NewprerequisiteNo’
WHERE CourseID =’CourseID’ AND prerequisite =’PrequisiteNoOLD’;
For addition of new prerequisite course in data table, we just need to use INSERT
INSERT INTO prerequisite (CourseNo, PrerequisiteNo)
VALUES ('CourseID ', 'NewPrerequisite');
6. Pick one instructor from your table and show which department course he is
teaching.
SELECT DepartmentID,CourseName
From course
WHERE CourseNo =(SELECT CourseNo From section Where
InstructorName="King")
8. One student’s grade has changed after completing extra assignments. Write a
command to do that.
Smith grade has been changed from B to A for Section ID 112. For this purpose, update query
was applied.