post #1 of 1
Thread Starter 
hi guys, i need some help on a question, i missed the lecture about relational algebra and calculus, and im stuck on this last question!


The following relations are part of a school database:
STUDENT(STUD#, STUD_NAME, MAJOR, YEAR, GPA)
TEACHER(FACULTY#, DEPT, TEACHERNAME)
ENROLLMENT(STUD#, COURSE#, GRADE)
RESPONSIBILITY(FACULTY#, COURSE#)

h. What are the names of teachers who are responsible for courses in which students whose name is 'JONES'
are enrolled?


my answer

Calculus

RETRIEVE TEACHERNAME
FROM TEACHER, ENROLLMENT, STUDENT, RESPONSIBILITY
WHERE ENROLLMENT.STUD#=STUDENT.STUD#
WHERE RESPONSIBILITY.COURSE#=ENROLLMENT.COURSE#
WHERE RESPONSIBILITY.FACULTY#=TEACHER.FACULTY#
AND STUD_NAME = ‘JONES’
INTO ANSWER

Algebra

SELECT stud_name WHERE stud_name=’JONES’ giving jones
JOIN jones and enrollment over STUD# giving jones_stud#
JOIN jones_stud# and responsibility over course# giving jones_stud#ncourse#
JOIN jones_stud#ncourse# and teacher over faculty# giving teacherwithjones
PROJECT teacherwithjones over(teachername) giving answer


Thanks
Edited by turbonerds - 9/23/12 at 4:52pm
sig rig
(17 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k 4.4ghz ASRock P67 Extreme4 (B3) Gigabyte GTX 560 Ti SoC Patriot Viper DDR3 2x4gb 1600 MHZ CL9 
Hard DriveHard DriveHard DriveOS
WD 500GB BLACK Samsung 840 Maxtor 320 GB Windows 7 Home Prenium 64 bit 
MonitorMonitorKeyboardPower
ASUS VS247 Samsung BX2431 Razer BlackWidow OCZ STEALTHXSTREAM 2 600W 
CaseMouseMouse PadAudio
COOLERMASTER HAF 922 Logitech G9X SteelSeries QcK Creative X-Fi Titanium Fatality - Audio Techn... 
  hide details  
Reply
sig rig
(17 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k 4.4ghz ASRock P67 Extreme4 (B3) Gigabyte GTX 560 Ti SoC Patriot Viper DDR3 2x4gb 1600 MHZ CL9 
Hard DriveHard DriveHard DriveOS
WD 500GB BLACK Samsung 840 Maxtor 320 GB Windows 7 Home Prenium 64 bit 
MonitorMonitorKeyboardPower
ASUS VS247 Samsung BX2431 Razer BlackWidow OCZ STEALTHXSTREAM 2 600W 
CaseMouseMouse PadAudio
COOLERMASTER HAF 922 Logitech G9X SteelSeries QcK Creative X-Fi Titanium Fatality - Audio Techn... 
  hide details  
Reply