ics321-20090924-sql3 - ICS 321 Fall 2009 SQL: Queries,...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 321 Fall 2009 SQL: Queries, Constraints, Triggers (iii) Asst. Prof. Lipyeow Lim University of Hawaii at Manoa 9/24/2009 1 Lipyeow Lim -- University of Hawaii at Manoa
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline NULL values OUTER JOINs Constraints: CHECK constraints ASSERTIONs Triggers 9/24/2009 Lipyeow Lim -- University of Hawaii at Manoa 2
Background image of page 2
NULL Values Field values in a tuple are sometimes unknown (e.g., a rating has not been assigned) or inapplicable (e.g., no spouse’s name). SQL provides a special value null for such situations. The presence of null complicates many issues. E.g.: Special operators needed to check if value is/is not null . Is rating>8 true or false when rating is equal to null ? What about AND, OR and NOT connectives? We need a 3-valued logic (true, false and unknown ). Meaning of constructs must be defined carefully. (e.g., WHERE clause eliminates rows that don’t evaluate to true.) New operators (in particular, outer joins ) possible/needed. 9/24/2009 Lipyeow Lim -- University of Hawaii at Manoa 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example: Find the names of sailors age 21 and below Does this query return any row ? 9/24/2009 Lipyeow Lim -- University of Hawaii at Manoa 4 sid sname rating age 22 Dustin 7 45.0 31 Lubber 8 NULL 58 Rusty 10 35.0 SELECT S.sname FROM Sailors S WHERE S.age < 21
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

ics321-20090924-sql3 - ICS 321 Fall 2009 SQL: Queries,...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online