Tom Kelliher, CS 318
Mar. 4, 2002
Formal specification due Friday. What I expect.
Read 8.1--4. Bring hard hats and safety glasses.
DRC.
Normalization theory, functional dependencies.
The translation to English isn't all that clear.
Examples. What's the English translation of each of the following?
SELECT T.Id FROM Transcript T WHERE T.CrsCode = 'CS318' AND T.Semester = 'S2002';

SELECT S.Name FROM Student S, Transcript T WHERE S.Id = T.Id AND T.CrsCode = 'CS318' AND T.Semester = 'S2002';

How would this change if we added Grade to the query target?
SELECT T.Id
FROM Transcript T
WHERE T.CrsCode IN (SELECT C.CrsCode
FROM Course C
WHERE C.DeptId = 'CS');
Translate using a view for the sub-query:


Modify to retrieve names.
SELECT R.StuId, P.Id, R.CrsCode
FROM Transcript R, Professor P
WHERE R.Semester <> 'S2002'
AND R.CrsCode IN (SELECT T.CrsCode
FROM Teaching T
WHERE T.ProfId = P.Id
AND T.Semester = 'S2002');
Again, use a view:


In plain English, they're equivalent when queries depend upon only the tuples found in a set of relations, not tuples outside the set.
.
.
. (Assume R has
attributes A, B, C and S has attributes D and E.
.