The Relational Rules (Cont.)


Rule 2: Access Rows by Content Only Rule
Users can only retrieve rows by their content, which is the attribute values that exist in each row.

student
sid lname fname class phone
1 Jones Allan 2 555-1234
2 Smith John 3 555-4321
3 Brown Harry 2 555-1122
5 White Edward 3 555-3344
enrollment
sid cno major
1 101 No
1 108 Yes
2 105 No
3 101 Yes
3 108 No
5 102 No
5 105 No

SQL> SELECT sid, lname FROM student
  2>   WHERE class = 2;
sid lname
1 Jones
3 Brown

Rule 3: The Unique Row Rule
Two tuples in a relation cannot be identical in all column values at once.

Rule 4: Entity Integrity Rule
No column belonging to a primary key of a table T is allowed to take on NULL values for any row in T.

Comments
However, not all databases follow the relational rules. For example, some databases allow the table rows to be ordered, which should not happen because a table is actually a set and a row is a set element. Some databases may also allow duplicate rows to exist.




      I won $1M in the lottery    
      I gave a quarter of it to charity,    
      and put the other $999,999.75 in the bank.