Relational algebra

I was wondering if I can get some feedback on relational algebra that I did, and any tips for improving it, if you see something wrong with my SQL, can you point it out.

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';

ΠUnitNo (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 (Student))))

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))))

+3
source share
3 answers

there is a problem in the from clause, I deleted the point between C.Course

SELECT CU.UnitNo
FROM C Course, CU CourseUnit
WHERE C.CourseName = CU.CourseNo
AND C.CourseName = 'Research';
+3
source

Pentium10 JOIN WHERE. , , .

SELECT CU.UnitNo
FROM C Course, CU CourseUnit
WHERE C.CourseName = CU.CourseNo
AND C.CourseName = 'Research';

SELECT CU.UnitNo
FROM C Course 
INNER JOIN CU CourseUnit
  ON C.CourseName = CU.CourseNo
WHERE C.CourseName = 'Research';

( : , - , SQL Server . )

+1

, , . ( APL-?)

C .

.

, Query By Example Linq - .

-1

Source: https://habr.com/ru/post/1729827/


All Articles