Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

w Pg. 02 Question Two Leaming Outcomers) Question Two 10 Marks Create a SQL stat

ID: 3606654 • Letter: W

Question

w

Pg. 02 Question Two Leaming Outcomers) Question Two 10 Marks Create a SQL statement to retrieve information from a relational database Consider the relations: requested STUDENT | Student# Std-Name Address Khan Madina Muhammad Yanbu 3 Ahmad Riyadh |+| COURSE Student# Course | Course-Name 1 IT342Enterprise Systems 2 IT407Professional Issues 2 IT445DSS Write a query using the Right Outer Join to retrieve the record from the two relations. Also, construct the table displaying the output of your query

Explanation / Answer

Hi,

For a join between 2 tables, the table which is writen on the left hamd side of the join is called a left table and a table which is written on the right hand side of the join is called right hand side table. In the given question, if we join student table with course table, the student table is considered as left table and course table is right table.

Also, it is asked in the question to use the right join. Joon will work on the basis of join condition. We need to find the colimn which is common in both student and course relation. The common column is student#. So, we need to use this column in the join condition. Also, as it is a right join it will return the unmatched rows from the right table which is course table.

Query-

select * from student s right outer join course c on s.student_number=c.student_number;

Output-

student# std-name Address student# course course_name 1 Khan Madina 1 IT342 Enterprise systems 2 Mohammad Yanbu 2 IT407 Professional Issues null null null 3 IT445 DSS