How to represent NULL in relational algebra? In the 3rd part of the question below:


  Study the tables given below and write relational algebra  expressions for the queries that follow.

STUDENT(+ROLLNO, NAME, AGE, GENDER, ADDRESS, ADVISOR)
COURSE(+COURSEID, CNAME, CREDITS)
PROFESSOR(+PROFID, PNAME, PHONE)
ENROLLMENT(+ROLLNO, +COURSEID, GRADE)

  
  Primary keys are preceded by a +. ADVISOR is a foreign key referring to PROFESSOR table. ROLLNO and COURSEID in ENROLLMENT are also foreign keys referring to THE primary keys with the same name.
  
  
  Names of femal students
  Names of male students along with advisor name
  Roll Number and name of students who have not enrolled for any course.
  


How do I represent NULL marks in relational algebra?

I projected STUDENT NAME and ROLLNO after assigning COURSEID from ENROLLMENT table as

COURSEID = NULL


Is this valid?
There are no NULL values in relational algebra. Here you can use the antijoin operator &#x25B7;:


  πROLLNO, NAME(STUDENT &#x25B7;ENROLLMENT)


that selects all records from STUDENT where the ROLLNO is not in ENROLLMENT.

In SQL there are NULL values. You may use a left outer join and select the rows where the courseid is NULL:

select STUDENT.ROLLNO, STUDENT.NAME
from STUDENT left outer join ENROLLMENT 
    on(STUDENT.ROLLNO=ENROLLMENT.ROLLNO)
where ENROLLMENT.COURSEID is null