- JOIN DEMONSTRATIONS

- INNER JOIN
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER FROM
STUDENT_INFO A, COMPLETED_COURSES B
WHERE A.PIN = B.PIN;


SELECT A.BOOK_NAME, A.PUBLISHER, B.INSTRUCTOR, B.PIN FROM
BOOKS A, COMPLETED_COURSES B
WHERE A.CALL_NUMBER = B.CALL_NUMBER;



- LEFT JOIN
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER FROM
STUDENT_INFO A
LEFT JOIN COMPLETED_COURSES B ON A.PIN = B.PIN;


- RIGHT JOIN
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER FROM
STUDENT_INFO A
RIGHT JOIN COMPLETED_COURSES B ON A.PIN = B.PIN;


- FULL JOIN
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER FROM
STUDENT_INFO A
LEFT JOIN COMPLETED_COURSES B ON A.PIN = B.PIN
UNION
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER FROM
STUDENT_INFO A
RIGHT JOIN COMPLETED_COURSES B ON A.PIN = B.PIN;


-- STUDENT DETAILS
SELECT A.FNAME, A.LNAME, A.PIN, A.CLASS, B.BOOK_NAME, B.ISBN FROM 
STUDENT_INFO A, BOOKS B 
WHERE A.CLASS = B.CALL_NUMBER 
AND A.PIN = '$Pin';
 



- CREATE A VIEW FROM INNER JOIN
CREATE VIEW STUDENT_SCHEDULE_VW 
AS 
SELECT A.LNAME, A.FNAME, B.CALL_NUMBER 
FROM
STUDENT_INFO A, COMPLETED_COURSES B
WHERE 
A.PIN = B.PIN;
