Full Answer
Feb 28, 2018 · Given the database below, project the names of the students who are not enrolled in a course using relational algebra. Students(snum, sname, major, standing, age, gpa) Faculty(fid, fname, deptid) Courses(cnum, cname, course_level, credits) Offerings(onum, cnum, day, starttime, endtime, room, max_occupancy, fid) Enrolled(snum, onum) I can get ...
h)Find the names of students not enrolled in any class. i)Return the average age of all the students enrolled in 'Database Systems'. j)Return the class name for all classes with more than two students and class name starts with the letter 'D'. k)Return the age of the oldest student enrolled in a course taught by 'Ivana Teach'.
Get names of students who have have not enrolled in any class. project[NAME](student join (project[SID](student) minus project[SID](enroll))); Get names of students who have have enrolled in CSc2310 or CSc 2510.
For example, the query "Student Enrolled" returns the ID and name of all students who are not enrolled in any courses. Like some other relational operators (e.g., intersection, natural join), semijoin and antijoin are abbreviations - they can be defined in terms of other relational operators.
A relational database is composed of two-dimensional tables . (A table can also be called a relation, although relational "purists" would argue that there is a subtle distinction between the two.) Each "row" of a table is called a tuple. Each tuple is composed of fields, one for each attribute of the table. (The attributes are the concepts, ...
In any but the most trivial relational databases there will be two, three, or possibly many more tables. In such a setting, to answer most interesting queries will require the use of two or more tables. This is where the join operation becomes useful.
That is, the two relations must have the same number of attributes and corresponding attributes must be of the same domain. ( Note: A relational model purist (such as C.J. Date) would probably argue that, to apply a set-theoretic operation to two tables, they must have precisely the same collection of attributes (in terms of not only domains but also names). Under this restriction, using the attribute-renaming features discussed above would often be necessary before applying a union, intersection, or difference operator. End of note. )
One of the central functions of a DBMS is to answer questions (about the data in the database) posed to it by users. (Indeed, there would be no reason to store the data in the first place if there were no desire to retrieve bits and pieces of it later for the purpose of answering such questions.)