Course: Database Given the following schemas for a student record: STUDENTS (student_id, student_name, region) COURSES (course_id, course_name, subject_type, lecturer_name) RESULTS (student_id,...



Course: Database


Given the following schemas for a student record:




STUDENTS (student_id, student_name, region)
COURSES (course_id, course_name, subject_type, lecturer_name)
RESULTS (student_id, course_id, score, result_status)


STUDENTS relation shows the information of the students. The COURSE relation specifies the course details. The RESULTS relation lists the scores that students obtain for each course taken.


*Please execute this SQL codes for creating the table schemas mentioned above, Then execute the tasks in the table accordingly using proper SQL queries and Write your answer into the Answer Template


CREATE TABLE STUDENTS (student_id VARCHAR(10) PRIMARY KEY, student_name VARCHAR(150), region VARCHAR(50));


CREATE TABLE COURSES (course_id VARCHAR(10) PRIMARY KEY, course_name VARCHAR(150), subject_type VARCHAR(50), lecturer_name VARCHAR(150));


CREATE TABLE RESULTS (student_id VARCHAR(10), course_id VARCHAR(10), score NUMBER, result_status VARCHAR(20), CONSTRAINT pk_results PRIMARY KEY (student_id, course_id), CONSTRAINT fk_results_student FOREIGN KEY (student_id) references STUDENTS(student_id), CONSTRAINT fk_results_courses FOREIGN KEY (course_id) references COURSES(course_id));



Tasks:


++Insert the data into the three relations STUDENTS, COURSES, and RESULTSaccording to the data given below:


Table 1: STUDENTS relation




































student_id

student_name

region
67540Anas ForrestFlorida
87543Edie JohnstonWashington
98560Haley HibbertArizona
54870Lorenzo WhitneyWashington
76590Kate WoodWashington

Table 2: COURSES relation




































course_id

course_name

subject_type

lecturer_name
786ScienceMathMaggie
764EducationDrawingMaggie
579EngineeringDigitalMary
787EngineeringMathJude Hoffman

Table 3: RESULTS relation






















































student_id

course_id

score

result_status
7659057980Good
5487078676Good
8754378769Good
7659078760Average
6754076490Good
6754078679Good
8754376450Failed






















































Question



SQL Statement



++Insert the data into the three relations STUDENTS, COURSES, and RESULTS
according to the data given





List the course_id and the score




In RESUTLS relation, list only the result_status, student id, and the score for those who get “good” and “average” results.



Show the student id who score more than 75 marks.




A new joint staff Gary will take over the Drawing subject in Education course (course ID: 764). Update the information of the course accordingly


List the lecturer names that teach Engineering course


Show the list of students who originate from Washignton


List the course_id and score from the RESULTS


List the students who get the score between 50 – 70


List the lecturer names that consists of the letter ‘r’ in the third letter



List the information (student_id and course_id) for the students who take the course of Science Math (course_id: 786) and Engineering Math (course_id: 787)




Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here