Ch3CQueries - - File name: Ch3CQueries.sql - by J. Chen...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
-- File name: Ch3CQueries.sql -- by J. Chen 9/1/08 - COLUMN s_id FORMAT A6 COLUMN s_last FORMAT A8 COLUMN s_first FORMAT A8 COLUMN f_id FORMAT 999 COLUMN f_last FORMAT A8 C -- chapter 3C, Figure 3-43; p161 SELECT s_id, s_last, s_first, student.f_id, f_last FROM student, faculty WHERE student.f_id = faculty.f_id; W SELECT s_id, s_last, s_first, f_id, f_last FROM student NATURAL JOIN faculty; F -- chapter 3C, Figure 3-45; p163 SELECT f_last FROM faculty, course_section, term WHERE faculty.f_id = course_section.f_id AND course_section.term_id =term.term_id AND term_desc = 'Summer 2007'; A -- chapter 3C, Figure 3-47; p165 -- MODIFIED VERSION SELECT course.course_name, grade FROM student, enrollment, course_section, course WHERE student.s_id = enrollment.s_id AND enrollment.c_sec_id = course_section.c_sec_id AND course_section.course_no = course.course_no AND s_last = 'Jones' AND s_first = 'Tammy'; A -- original version SELECT course.course_no, grade FROM student, enrollment, course_section, course WHERE student.s_id = enrollment.s_id AND enrollment.c_sec_id = course_section.c_sec_id AND course_section.course_no = course.course_no AND s_last = 'Jones' AND s_first = 'Tammy'; A -- chapter 3C, Figure 3-48; p166 -- Cartesian Product SELECT s_id, s_last, s_first, student.f_id, f_last FROM student, faculty; F -- chapter 3C, Figure 3-49; p167 SELECT c_sec_id, location.loc_id FROM course_section, location WHERE course_section.loc_id = location.loc_id; W -- chapter 3C, Figure 3-50; p168 -- OUTER JOIN (slightly different from the text) SELECT c_sec_id, location.loc_id FROM course_section, location
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
WHERE course_section.loc_id(+) = location.loc_id; W -- text's version SELECT location.loc_id, c_sec_id
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Ch3CQueries - - File name: Ch3CQueries.sql - by J. Chen...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online