我想知道我是否可以就已经完成的关系代数获得一些反馈,以及有关改进它的任何建议,如果您发现我的SQL有任何问题,是否可以指出呢。
SELECT CourseName
FROM Course
WHERE CourseNo = 6;
∏CourseName(σCourseNo= 6(Course))
SELECT CU.UnitNo
FROM C.Course, CU CourseUnit
WHERE C.CourseName = CU.CourseNo
AND C.CourseName = 'Research';
NoUnitNo(CourseUnit(σCourseName='Research'(Course)))
SELECT U.UnitName
FROM S Student, SU StudentUnit, U Unit
WHERE S.StudentNo = SU.StudentNo
AND SU.UnitNo = U.UnitNo
AND S.StudentName = 'John Perry';
∏UnitName(Unit(StudentUnit(σStudentName=’John Perry’(学生))))
SELECT count(S.StudentNo) ResearchStudents
FROM C Course, S Student
WHERE C.CourseNo = S.CourseNo
AND C.CourseName = 'Research';
∏ResearchStudents((C)count(StudentNo)(Student(σCourseName=‘Research’(Course))))
最佳答案
在from子句中有一个问题,我删除了C.Course之间的一个点
SELECT CU.UnitNo
FROM C Course, CU CourseUnit
WHERE C.CourseName = CU.CourseNo
AND C.CourseName = 'Research';