Relational Operations

                 Class Exercise:  Relational Operations

Refer to the university database and the following relation definitions for
the questions that follow:
   Student(sId, sName, major, classYear, birthdate)
   Enrollment(sId, cName)
   Course(cName, meetingTime, Room, FId)
   Stumajor(sId, sName, major)
   Senior(sId, sName, major)
   NbrCruncher(sId, sName, major)

Write SQL statements for the relational operations in 1 - 9.
1. Projecting student id, student name, and major from the Student relation
   (table) could produce the StuMajor relation. The resulting tuples (rows)
   would be:


   
2. A selection (restrict) operation could be performed on StuMajor to produce
   the NbrCruncher relation. If NbrCruncher tuples are selected on the basis
   of major being equal to 'ACCT', 'CSCI', or 'MATH', those included in the 
   new relation would be:


   
3. A combination of restrict (selection) and projection of sId, sName, major
   on the Student relation for senior students could yield tuples for the 
   Senior relation. These tuple values would be:


   
4. A partial listing of the tuple produced from the product of Student and 
   Enrollment would include:


   
5. Combining product, selection, and possibly projection operations can 
   produce meaningful information. A join of Student and Enrollment on 
   sId projecting only student id, student name and course code would 
   illustrate this idea. The resulting tuples would include:



6. CountDowners, a student group, is recruiting both seniors and number 
   crunchers. The union of Senior and NbrCruncher would produce:


   
7. QuantSystems plans to recruit senior students that are number crunchers.
   The intersection of Senior and NbrCruncher would produce:


   
8. The Arts & Letters Society would like to award quill pens and papyrus 
   scrolls to seniors who are not number crunchers.  The difference (aka 
   minus) operation,  Senior - NbrCruncher, would produce:

   
   
9. Determine those senior students not enrolled for any class by a 
   difference operation implemented with a correlated subquery using the 
   NOT EXISTS operator.